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 extends RuntimeData 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 be null.
  • Field Details

    • delayedRunnable

      protected Runnable delayedRunnable
      The delayed runnable of this scheduled runtime data or null.
    • delayedFuture

      protected final ScheduledFuture<?> delayedFuture
      The future of the delayed runnable returned from the scheduled executor or null.
  • Constructor Details

    • 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 or null.
      pendingAfterFlush - The work (if present) to be run after the next flush or null.
    • 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 or null. 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 or null. 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 or null.
      pendingAfterFlush - The work (if present) to be run after the next flush or null.
      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 Details

    • 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 class AbstractObjectOneWorkExecutor.RuntimeData
      Returns:
      Whether this runtime data has pending work.
    • getDelayedRunnable

      public Runnable getDelayedRunnable()
      Gets the delayed runnable of this scheduled runtime data or null.
      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.