public abstract class CancellableLoop
extends java.lang.Object
implements java.lang.Runnable
ExecutorService
.Constructor and Description |
---|
CancellableLoop() |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Interrupts the loop.
|
protected void |
handleInterruptedException(java.lang.InterruptedException e)
An
InterruptedException was thrown. |
boolean |
isRunning() |
protected abstract void |
loop()
The body of the loop.
|
void |
run() |
protected void |
setup()
The setup block for the loop.
|
public void run()
run
in interface java.lang.Runnable
protected void setup()
loop()
.protected abstract void loop() throws java.lang.InterruptedException
CancellableLoop
has been interrupted externally or by calling
cancel()
.java.lang.InterruptedException
protected void handleInterruptedException(java.lang.InterruptedException e)
InterruptedException
was thrown.public void cancel()
public boolean isRunning()
true
if the loop is running