Class ScheduledObjectOneWorkRunnable<O>
- java.lang.Object
-
- de.aristaflow.adept2.util.threading.executor.AbstractObjectRunnable<O,O,ScheduledObjectOneWorkExecutor.ScheduledRuntimeData>
-
- de.aristaflow.adept2.util.threading.executor.ScheduledObjectOneWorkRunnable<O>
-
- Type Parameters:
O
- The type of object for which to run.
- All Implemented Interfaces:
ObjectRunnable<O,O>
,Runnable
public class ScheduledObjectOneWorkRunnable<O> extends AbstractObjectRunnable<O,O,ScheduledObjectOneWorkExecutor.ScheduledRuntimeData>
A runnable that will enqueue a delayed object runnable as soon as the delay elapsed.
This runnable is used within a scheduled executor. When running, it removes the delayed runnable from the corresponding runtime data and makes it available as new (pending) work to be executed normally. Whether the work is then before or after a flush depends on whether a flush is currently pending or whether the executor should block until after flash there has already been work done for this object after the previous flush.
-
-
Field Summary
Fields Modifier and Type Field Description protected ScheduledObjectOneWorkExecutor<O>
executor
The executor to which to add the delayed runnable as soon as this scheduledObjectRunnable
is eventually executed.-
Fields inherited from class de.aristaflow.adept2.util.threading.executor.AbstractObjectRunnable
logger, objects, terminate
-
-
Constructor Summary
Constructors Constructor Description ScheduledObjectOneWorkRunnable(O object, ScheduledObjectOneWorkExecutor<O> executor, AtomicInteger terminate, Logger logger)
Creates a newObjectRunnable
that enqueues a delayed runnable to be executed for a specific object after a specific delay.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
runForObject()
Runs this runnable actually.-
Methods inherited from class de.aristaflow.adept2.util.threading.executor.AbstractObjectRunnable
awaitTermination, getIndexObject, getRegisteredObject, run
-
-
-
-
Field Detail
-
executor
protected final ScheduledObjectOneWorkExecutor<O> executor
The executor to which to add the delayed runnable as soon as this scheduledObjectRunnable
is eventually executed.
-
-
Constructor Detail
-
ScheduledObjectOneWorkRunnable
public ScheduledObjectOneWorkRunnable(O object, ScheduledObjectOneWorkExecutor<O> executor, AtomicInteger terminate, Logger logger)
Creates a newObjectRunnable
that enqueues a delayed runnable to be executed for a specific object after a specific delay.- Parameters:
object
- The object of this runnable.executor
- The executor to which to add the delayed runnable.terminate
- The amount of termination requests. This allows for synchronising across different objects.logger
- The logger which to use for the progress of enqueueing the delayed runnable.
-
-
Method Detail
-
runForObject
protected boolean runForObject()
Description copied from class:AbstractObjectRunnable
Runs this runnable actually. Activation and termination signalling are already handled, implementations only need to react to termination requests.- Specified by:
runForObject
in classAbstractObjectRunnable<O,O,ScheduledObjectOneWorkExecutor.ScheduledRuntimeData>
- Returns:
- Whether the work for the object has been terminated. Otherwise there is work left and
the termination is not signalled. With a termination request, return
true
, only returnfalse
if you want to continue to work without interruption, e.g. to change the executing thread.
-
-