Class ScheduledObjectOneWorkExecutor.ScheduledRuntimeData
- java.lang.Object
-
- de.aristaflow.adept2.util.threading.executor.AbstractObjectOneWorkExecutor.RuntimeData
-
- de.aristaflow.adept2.util.threading.executor.ScheduledObjectOneWorkExecutor.ScheduledRuntimeData
-
- Enclosing class:
- ScheduledObjectOneWorkExecutor<O>
public static class ScheduledObjectOneWorkExecutor.ScheduledRuntimeData extends AbstractObjectOneWorkExecutor.RuntimeData
This class extendsRuntimeData
by a runnable which will be delayed and the corresponding future stemming from scheduling the runnable in the scheduling executor. If the runtime data, i. e. the object for which the runtime data is registered, has no delayed runnable (but a simple pending runnable), the delayed runnable and the corresponding future will benull
.
-
-
Field Summary
Fields Modifier and Type Field Description protected ScheduledFuture<?>
delayedFuture
The future of the delayed runnable returned from the scheduled executor ornull
.protected Runnable
delayedRunnable
The delayed runnable of this scheduled runtime data ornull
.-
Fields inherited from class de.aristaflow.adept2.util.threading.executor.AbstractObjectOneWorkExecutor.RuntimeData
blockUntilFlush, pendingAfterFlush, pendingBeforeFlush
-
-
Constructor Summary
Constructors Constructor Description ScheduledRuntimeData(AbstractObjectOneWorkExecutor.RuntimeData rtData)
Creates new scheduled runtime data having the work of the designated runtime and no delayed runnable.ScheduledRuntimeData(ScheduledObjectOneWorkExecutor.ScheduledRuntimeData rtData, boolean blockUntilFlush)
Creates new scheduled runtime data having the work of the designated runtime data and the designated work pending for after the next flush and optionally blocks until the next flush.ScheduledRuntimeData(ScheduledObjectOneWorkExecutor.ScheduledRuntimeData rtData, Runnable pendingAfterFlush)
Creates new scheduled runtime data having the work of the designated runtime data and the designated work pending for after the next flush.ScheduledRuntimeData(Runnable pendingBeforeFlush, ScheduledObjectOneWorkExecutor.ScheduledRuntimeData rtData)
Creates new scheduled runtime data having the work of the designated runtime data and the designated work pending for before the next flush.ScheduledRuntimeData(Runnable pendingBeforeFlush, Runnable pendingAfterFlush)
Creates new scheduled runtime data having the designated pending work and no delayed runnable.ScheduledRuntimeData(Runnable pendingBeforeFlush, Runnable pendingAfterFlush, boolean blockUntilFlush, Runnable delayedRunnable, ScheduledFuture<?> scheduled)
Creates new scheduled runtime data having the designated pending work and the designated delayed runnable (and the corresponding future).ScheduledRuntimeData(Runnable delayedRunnable, ScheduledFuture<?> scheduled)
Creates new scheduled runtime data having no pending work and the designated delayed runnable (and the corresponding future).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abortDelayed()
Aborts the delayed runnable and future, that is, the delayed runnable will not be executed.Runnable
getDelayedRunnable()
Gets the delayed runnable of this scheduled runtime data ornull
.boolean
hasDelayed()
Gets whether this scheduled runtime data has a delayed runnable.boolean
hasPendingWork()
Gets whether this runtime data has pending work.-
Methods inherited from class de.aristaflow.adept2.util.threading.executor.AbstractObjectOneWorkExecutor.RuntimeData
blockUntilFlush, getPendingAfterFlush, getPendingBeforeFlush, hasPendingAfterFlush, hasPendingBeforeFlush
-
-
-
-
Field Detail
-
delayedRunnable
protected Runnable delayedRunnable
The delayed runnable of this scheduled runtime data ornull
.
-
delayedFuture
protected final ScheduledFuture<?> delayedFuture
The future of the delayed runnable returned from the scheduled executor ornull
.
-
-
Constructor Detail
-
ScheduledRuntimeData
public ScheduledRuntimeData(Runnable pendingBeforeFlush, Runnable pendingAfterFlush)
Creates new scheduled runtime data having the designated pending work and no delayed runnable.- 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
.
-
ScheduledRuntimeData
public ScheduledRuntimeData(AbstractObjectOneWorkExecutor.RuntimeData rtData)
Creates new scheduled runtime data having the work of the designated runtime and no delayed runnable.- Parameters:
rtData
- The runtime data of which to take over the work.
-
ScheduledRuntimeData
public ScheduledRuntimeData(Runnable pendingBeforeFlush, ScheduledObjectOneWorkExecutor.ScheduledRuntimeData rtData)
Creates new scheduled 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.
-
ScheduledRuntimeData
public ScheduledRuntimeData(ScheduledObjectOneWorkExecutor.ScheduledRuntimeData rtData, boolean blockUntilFlush)
Creates new scheduled runtime data having the work of the designated runtime data and the designated work pending for after the next flush and optionally blocks until 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.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.
-
ScheduledRuntimeData
public ScheduledRuntimeData(ScheduledObjectOneWorkExecutor.ScheduledRuntimeData rtData, Runnable pendingAfterFlush)
Creates new scheduled 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.
-
ScheduledRuntimeData
public ScheduledRuntimeData(Runnable delayedRunnable, ScheduledFuture<?> scheduled)
Creates new scheduled runtime data having no pending work and the designated delayed runnable (and the corresponding future).- Parameters:
delayedRunnable
- The delayed runnable for the scheduled runtime data.scheduled
- The future for the scheduled work.
-
ScheduledRuntimeData
public ScheduledRuntimeData(Runnable pendingBeforeFlush, Runnable pendingAfterFlush, boolean blockUntilFlush, Runnable delayedRunnable, ScheduledFuture<?> scheduled)
Creates new scheduled runtime data having the designated pending work and the designated delayed runnable (and the corresponding future).- 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.delayedRunnable
- The delayed runnable for the scheduled runtime data.scheduled
- The future for the scheduled work.
-
-
Method Detail
-
hasDelayed
public boolean hasDelayed()
Gets whether this scheduled runtime data has a delayed runnable.- Returns:
- Whether this scheduled runtime data has a delayed runnable.
-
hasPendingWork
public boolean hasPendingWork()
Description copied from class:AbstractObjectOneWorkExecutor.RuntimeData
Gets whether this runtime data has pending work.- Overrides:
hasPendingWork
in classAbstractObjectOneWorkExecutor.RuntimeData
- Returns:
- Whether this runtime data has pending work.
-
getDelayedRunnable
public Runnable getDelayedRunnable()
Gets the delayed runnable of this scheduled runtime data ornull
.- Returns:
- The delayed runnable of this scheduled runtime data or
null
.
-
abortDelayed
public void abortDelayed()
Aborts the delayed runnable and future, that is, the delayed runnable will not be executed.
-
-