public abstract class GridWorker extends Object implements Runnable
| Modifier and Type | Field and Description |
|---|---|
protected static GridLogger |
log
Grid logger.
|
| Modifier | Constructor and Description |
|---|---|
protected |
GridWorker(String gridName,
String name,
GridLogger log)
Creates new grid worker with given parameters.
|
protected |
GridWorker(String gridName,
String name,
GridLogger log,
GridWorkerListener lsnr)
Creates new grid worker with given parameters.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
body()
The implementation should provide the execution body for this runnable.
|
void |
cancel()
Cancels this runnable interrupting actual runner.
|
protected void |
cleanup()
Optional method that will be called after runnable is finished.
|
String |
gridName()
Gets name of the grid this runnable belongs to.
|
boolean |
isCancelled()
Tests whether or not this runnable is cancelled.
|
boolean |
isDone()
Tests whether or not this runnable is finished.
|
void |
join()
Joins this runnable.
|
String |
name()
Gets this runnable name.
|
Thread |
parent() |
void |
run() |
Thread |
runner() |
String |
toString() |
protected static volatile GridLogger log
protected GridWorker(String gridName, String name, GridLogger log, @Nullable GridWorkerListener lsnr)
gridName - Name of grid this runnable is used in.name - Worker name. Note that in general thread name and worker (runnable) name are two
different things. The same worker can be executed by multiple threads and therefore
for logging and debugging purposes we separate the two.log - Grid logger to be used.lsnr - Listener for life-cycle events.protected GridWorker(@Nullable String gridName, String name, GridLogger log)
gridName - Name of grid this runnable is used in.name - Worker name. Note that in general thread name and worker (runnable) name are two
different things. The same worker can be executed by multiple threads and therefore
for logging and debugging purposes we separate the two.log - Grid logger to be used.protected abstract void body()
throws InterruptedException,
GridInterruptedException
InterruptedException - Thrown in case of interruption.GridInterruptedException - If interrupted.protected void cleanup()
public Thread parent()
public Thread runner()
public String gridName()
public String name()
public void cancel()
public void join()
throws InterruptedException
InterruptedException - Thrown in case of interruption.public boolean isCancelled()
true if this runnable is cancelled - false otherwise.Future.isCancelled()public boolean isDone()
true if this runnable is finished - false otherwise.Copyright © 2014. All rights reserved.