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.
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
FieldsModifier and TypeFieldDescriptionprotected final ScheduledObjectOneWorkExecutor<O>The executor to which to add the delayed runnable as soon as this scheduledObjectRunnableis eventually executed.Fields inherited from class de.aristaflow.adept2.util.threading.executor.AbstractObjectRunnable
logger, objects, terminate -
Constructor Summary
ConstructorsConstructorDescriptionScheduledObjectOneWorkRunnable(O object, ScheduledObjectOneWorkExecutor<O> executor, AtomicInteger terminate, Logger logger) Creates a newObjectRunnablethat enqueues a delayed runnable to be executed for a specific object after a specific delay. -
Method Summary
Methods inherited from class de.aristaflow.adept2.util.threading.executor.AbstractObjectRunnable
awaitTermination, getIndexObject, getRegisteredObject, run
-
Field Details
-
executor
The executor to which to add the delayed runnable as soon as this scheduledObjectRunnableis eventually executed.
-
-
Constructor Details
-
ScheduledObjectOneWorkRunnable
public ScheduledObjectOneWorkRunnable(O object, ScheduledObjectOneWorkExecutor<O> executor, AtomicInteger terminate, Logger logger) Creates a newObjectRunnablethat 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 Details
-
runForObject
protected boolean runForObject()Description copied from class:AbstractObjectRunnableRuns this runnable actually. Activation and termination signalling are already handled, implementations only need to react to termination requests.- Specified by:
runForObjectin 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 returnfalseif you want to continue to work without interruption, e.g. to change the executing thread.
-