Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/Timer.java')
-rw-r--r--org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/Timer.java100
1 files changed, 50 insertions, 50 deletions
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/Timer.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/Timer.java
index 1aad4dcd7..90bb88ae3 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/Timer.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/Timer.java
@@ -10,41 +10,39 @@
*******************************************************************************/
package org.eclipse.jdt.internal.debug.core.model;
-
/**
- * A timer notifies listeners when a specific amount
- * of time has passed.
+ * A timer notifies listeners when a specific amount of time has passed.
*
* @see ITimeoutListener
*/
public class Timer {
-
+
/**
* Listener to notify of a timeout
*/
private ITimeoutListener fListener;
-
+
/**
* Timeout value, in milliseconds
*/
private int fTimeout;
-
+
/**
* Whether this timer's thread is alive
*/
private boolean fAlive = true;
-
+
/**
- * Whether this timer has been started and
- * has not yet timed out or been stopped.
+ * Whether this timer has been started and has not yet timed out or been
+ * stopped.
*/
private boolean fStarted = false;
-
+
/**
* The single thread used for each request.
*/
private Thread fThread;
-
+
/**
* Constructs a new timer
*/
@@ -58,7 +56,7 @@ public class Timer {
Thread.sleep(getTimeout());
} catch (InterruptedException e) {
interrupted = true;
- }
+ }
if (!interrupted) {
if (getListener() != null) {
setStarted(false);
@@ -76,29 +74,30 @@ public class Timer {
}
/**
- * Starts this timer, and notifies the given listener when
- * the time has passed. A call to <code>stop</code>, before the
- * time expires, will cancel the the timer and timeout callback.
- * This method can only be called if this timer is idle (i.e.
- * <code>isStarted() == false<code>).
+ * Starts this timer, and notifies the given listener when the time has
+ * passed. A call to <code>stop</code>, before the time expires, will cancel
+ * the the timer and timeout callback. This method can only be called if
+ * this timer is idle (i.e. <code>isStarted() == false<code>).
*
- * @param listener The timer listener
- * @param ms The number of milliseconds to wait before
- * notifying the listener
+ * @param listener
+ * The timer listener
+ * @param ms
+ * The number of milliseconds to wait before notifying the
+ * listener
*/
public void start(ITimeoutListener listener, int ms) {
if (isStarted()) {
- throw new IllegalStateException(JDIDebugModelMessages.Timer_Timer_cannot_be_started_more_than_once_1);
+ throw new IllegalStateException(
+ JDIDebugModelMessages.Timer_Timer_cannot_be_started_more_than_once_1);
}
setListener(listener);
setTimeout(ms);
setStarted(true);
getThread().interrupt();
}
-
+
/**
- * Stops this timer, cancelling any pending timeout
- * notification.
+ * Stops this timer, cancelling any pending timeout notification.
*/
public void stop() {
if (isAlive()) {
@@ -107,7 +106,7 @@ public class Timer {
getThread().interrupt();
}
}
-
+
/**
* Disposes this timer
*/
@@ -118,7 +117,7 @@ public class Timer {
setThread(null);
}
}
-
+
/**
* Returns whether this timer's thread is alive
*
@@ -129,12 +128,11 @@ public class Timer {
}
/**
- * Sets whether this timer's thread is alive. When
- * set to <code>false</code> this timer's thread
- * will exit on its next iteration.
+ * Sets whether this timer's thread is alive. When set to <code>false</code>
+ * this timer's thread will exit on its next iteration.
*
- * @param alive whether this timer's thread should
- * be alive
+ * @param alive
+ * whether this timer's thread should be alive
* @see #dispose()
*/
private void setAlive(boolean alive) {
@@ -151,32 +149,33 @@ public class Timer {
}
/**
- * Sets the listener to be notified if this
- * timer times out.
+ * Sets the listener to be notified if this timer times out.
*
- * @param listener timeout listener
+ * @param listener
+ * timeout listener
*/
private void setListener(ITimeoutListener listener) {
fListener = listener;
}
/**
- * Returns whether this timer has been started,
- * and has not yet timed out, or been stopped.
+ * Returns whether this timer has been started, and has not yet timed out,
+ * or been stopped.
*
- * @return whether this timer has been started,
- * and has not yet timed out, or been stopped
+ * @return whether this timer has been started, and has not yet timed out,
+ * or been stopped
*/
public boolean isStarted() {
return fStarted;
}
/**
- * Sets whether this timer has been started,
- * and has not yet timed out, or been stopped.
+ * Sets whether this timer has been started, and has not yet timed out, or
+ * been stopped.
*
- * @param started whether this timer has been started,
- * and has not yet timed out, or been stopped
+ * @param started
+ * whether this timer has been started, and has not yet timed
+ * out, or been stopped
*/
private void setStarted(boolean started) {
fStarted = started;
@@ -192,18 +191,18 @@ public class Timer {
}
/**
- * Sets this timer's thread used to perform
- * timeout processing
+ * Sets this timer's thread used to perform timeout processing
*
- * @param thread thread that waits for a timeout
+ * @param thread
+ * thread that waits for a timeout
*/
private void setThread(Thread thread) {
fThread = thread;
}
/**
- * Returns the amount of time, in milliseconds, that
- * this timer is/was waiting for.
+ * Returns the amount of time, in milliseconds, that this timer is/was
+ * waiting for.
*
* @return timeout value, in milliseconds
*/
@@ -212,10 +211,11 @@ public class Timer {
}
/**
- * Sets the amount of time, in milliseconds, that this
- * timer will wait for before timing out.
+ * Sets the amount of time, in milliseconds, that this timer will wait for
+ * before timing out.
*
- * @param timeout value, in milliseconds
+ * @param timeout
+ * value, in milliseconds
*/
private void setTimeout(int timeout) {
fTimeout = timeout;

Back to the top