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 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 Details

    • 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 Details

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

      public Runnable getPendingBeforeFlush()
      Gets the pending work to be executed before the next flush or null.
      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 or null.
      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 return false.
      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.