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>
public static class AbstractObjectOneWorkExecutor.RuntimeData extends Object
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 benull
, but not both at the same time. This would mean no work which will remove the corresponding object from the executor completely.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
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.protected Runnable
pendingAfterFlush
The work to be run after the next flush.protected Runnable
pendingBeforeFlush
The work (if present) to be run before the next flush (unless flush is with abortion).
-
Constructor Summary
Constructors Constructor Description RuntimeData(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.Runnable
getPendingAfterFlush()
Gets the pending work to be executed after the next flush ornull
.Runnable
getPendingBeforeFlush()
Gets the pending work to be executed before the next flush ornull
.boolean
hasPendingAfterFlush()
Gets whether this runtime data has pending work to be executed after the next flush.boolean
hasPendingBeforeFlush()
Gets whether this runtime data has pending work to be executed before the next flush.boolean
hasPendingWork()
Gets whether this runtime data has pending work.
-
-
-
Field Detail
-
pendingBeforeFlush
protected final Runnable pendingBeforeFlush
The work (if present) to be run before the next flush (unless flush is with abortion).
-
pendingAfterFlush
protected final Runnable pendingAfterFlush
The work to be run after the next flush. It will then be set as the other field.
-
blockUntilFlush
protected final boolean 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.
-
-
Constructor Detail
-
RuntimeData
public RuntimeData(Runnable pendingBeforeFlush, Runnable pendingAfterFlush)
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
public 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.- 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
public RuntimeData(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.- 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
public 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.- 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 Detail
-
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
public Runnable 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
public Runnable 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.
-
-