Class AbstractObjectOneWorkExecutor.RuntimeData
java.lang.Object
de.aristaflow.adept2.util.threading.executor.AbstractObjectOneWorkExecutor.RuntimeData
- Direct Known Subclasses:
ScheduledObjectOneWorkExecutor.ScheduledRuntimeData
- Enclosing class:
- AbstractObjectOneWorkExecutor<O,
R extends AbstractObjectOneWorkExecutor.RuntimeData>
This class represents runtime data for an one work executor. It consists of a runnable
representing the work to be done next (before the next flush) and a runnable representing the
work waiting for after the next flush. Each runnable can be
null, but not both at
the same time. This would mean no work which will remove the corresponding object from the
executor completely.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanWhether this runtime data has work that has been executed before a flush and no work should be executed until after the next flush.protected final RunnableThe work to be run after the next flush.protected final RunnableThe work (if present) to be run before the next flush (unless flush is with abortion). -
Constructor Summary
ConstructorsConstructorDescriptionRuntimeData(AbstractObjectOneWorkExecutor.RuntimeData rtData, boolean blockUntilFlush) Creates new runtime data having the work of the designated runtime data as pending after the next flush and optionally blocks until the next flush.RuntimeData(AbstractObjectOneWorkExecutor.RuntimeData rtData, Runnable pendingAfterFlush) Creates new runtime data having the work of the designated runtime data and the designated work pending for after the next flush.RuntimeData(Runnable pendingBeforeFlush, AbstractObjectOneWorkExecutor.RuntimeData rtData) Creates new runtime data having the work of the designated runtime data and the designated work pending for before the next flush.RuntimeData(Runnable pendingBeforeFlush, Runnable pendingAfterFlush) Creates new runtime data having the designated work and not blocking until flush.RuntimeData(Runnable pendingBeforeFlush, Runnable pendingAfterFlush, boolean blockUntilFlush) Creates new runtime data having the designated work. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets whether this runtime data has work that has been executed before a flush and no work should be executed until after the next flush.Gets the pending work to be executed after the next flush ornull.Gets the pending work to be executed before the next flush ornull.booleanGets whether this runtime data has pending work to be executed after the next flush.booleanGets whether this runtime data has pending work to be executed before the next flush.booleanGets whether this runtime data has pending work.
-
Field Details
-
pendingBeforeFlush
The work (if present) to be run before the next flush (unless flush is with abortion). -
pendingAfterFlush
The work to be run after the next flush. It will then be set as the other field. -
blockUntilFlush
protected final boolean blockUntilFlushWhether this runtime data has work that has been executed before a flush and no work should be executed until after the next flush.
-
-
Constructor Details
-
RuntimeData
Creates new runtime data having the designated work and not blocking until flush.- Parameters:
pendingBeforeFlush- The work (if present) to be run before the next flush ornull.pendingAfterFlush- The work (if present) to be run after the next flush ornull.
-
RuntimeData
public RuntimeData(Runnable pendingBeforeFlush, Runnable pendingAfterFlush, boolean blockUntilFlush) Creates new runtime data having the designated work.- Parameters:
pendingBeforeFlush- The work (if present) to be run before the next flush ornull.pendingAfterFlush- The work (if present) to be run after the next flush ornull.blockUntilFlush- Whether this runtime data has work that has been executed before a flush and no work should be executed until after the next flush.
-
RuntimeData
Creates new runtime data having the work of the designated runtime data and the designated work pending for before the next flush.- Parameters:
pendingBeforeFlush- The work (if present) to be run before the next flush ornull. This overrides the work to be run before the next flush of the designated runtime data.rtData- The runtime data of which to take over the work and to override the work before the next flush with the designated work.
-
RuntimeData
Creates new runtime data having the work of the designated runtime data as pending after the next flush and optionally blocks until the next flush.- Parameters:
rtData- The runtime data of which to take over the work after the next flush.blockUntilFlush- Whether this runtime data has work that has been executed before a flush and no work should be executed until after the next flush.
-
RuntimeData
Creates new runtime data having the work of the designated runtime data and the designated work pending for after the next flush.- Parameters:
rtData- The runtime data of which to take over the work and to override the work after the next flush with the designated work.pendingAfterFlush- The work (if present) to be run after the next flush ornull. This overrides the work to be run after the next flush of the designated runtime data.
-
-
Method Details
-
hasPendingBeforeFlush
public boolean hasPendingBeforeFlush()Gets whether this runtime data has pending work to be executed before the next flush.- Returns:
- Whether this runtime data has pending work to be executed before the next flush.
-
getPendingBeforeFlush
Gets the pending work to be executed before the next flush ornull.- Returns:
- The pending work to be executed before the next flush or
null.
-
hasPendingAfterFlush
public boolean hasPendingAfterFlush()Gets whether this runtime data has pending work to be executed after the next flush.- Returns:
- Whether this runtime data has pending work to be executed after the next flush.
-
getPendingAfterFlush
Gets the pending work to be executed after the next flush ornull.- Returns:
- The pending work to be executed after the next flush or
null.
-
hasPendingWork
public boolean hasPendingWork()Gets whether this runtime data has pending work.- Returns:
- Whether this runtime data has pending work.
-
blockUntilFlush
public boolean blockUntilFlush()Gets whether this runtime data has work that has been executed before a flush and no work should be executed until after the next flush. In case work should not be blocked as well as right after a flush, this will always returnfalse.- Returns:
- Whether this runtime data has work that has been executed before a flush and no work should be executed until after the next flush.
-