public abstract class GridWorker extends Object implements Runnable
| Modifier and Type | Field and Description |
|---|---|
protected IgniteLogger |
log
Ignite logger.
|
| Modifier | Constructor and Description |
|---|---|
protected |
GridWorker(String gridName,
String name,
IgniteLogger log)
Creates new grid worker with given parameters.
|
protected |
GridWorker(String gridName,
String name,
IgniteLogger 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.
|
void |
run() |
Thread |
runner() |
String |
toString() |
protected final IgniteLogger log
protected GridWorker(String gridName, String name, IgniteLogger 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,
IgniteLogger 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,
IgniteInterruptedCheckedException
InterruptedException - Thrown in case of interruption.IgniteInterruptedCheckedException - If interrupted.protected void cleanup()
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.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.9.0 Release Date : March 2 2017