Class BaseAsyncAction<D,​A extends Activity>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected A activity  
      protected boolean running  
      protected int slot  
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseAsyncAction​(A activity, int slot)  
    • Method Summary

      Modifier and Type Method Description
      boolean enqueue​(TrackedOp<D> opc)
      THIS DOCUMENTATION IS LIKELY OUT OF DATE The responsibility for tracking async pending against concurrency limits, including signaling for thread state, has been moved into the async event loop of the core motor.
      void onActivityDefUpdate​(ActivityDef activityDef)  
      void requestStop()
      Ask this component to stop cycling.
      abstract void startOpCycle​(TrackedOp<D> opc)
      Implementations that extend this base class can call this method in order to put an operation in flight.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.engineblock.activityapi.core.Action

        init
    • Field Detail

      • activity

        protected final A extends Activity activity
      • slot

        protected int slot
      • running

        protected boolean running
    • Constructor Detail

      • BaseAsyncAction

        public BaseAsyncAction​(A activity,
                               int slot)
    • Method Detail

      • enqueue

        public boolean enqueue​(TrackedOp<D> opc)
        Description copied from interface: AsyncAction
        THIS DOCUMENTATION IS LIKELY OUT OF DATE The responsibility for tracking async pending against concurrency limits, including signaling for thread state, has been moved into the async event loop of the core motor. If this experiment holds, then the docs here must be rewritten to be accurate for that approach. Enqueue a cycle to be executed by the action. This method should block unless or until the action accepts the cycle to be processed. This method is not allowed to reject a cycle. If it is unable to accept the cycle for any reason, it must throw an exception. Since the action implementation is presumed to be running some externally asynchronous process to support the action, it is up to the action itself to control when to block enqueueing. If the action is not actually asynchronous, then it may need to do downstream processing in order to open room in its concurrency limits for the new cycle. Each action implementation is responsible for tracking and controlling its own limits of concurrency. The BaseAsyncAction base class is a convenient starting point for such implementations. If the action is known to have additional open slots for an operations to be started (according to the configured concurrency limits), then it can signal such by returning true from this method.
        Specified by:
        enqueue in interface AsyncAction<D>
        Parameters:
        opc - The op context that holds state for this operation
        Returns:
        true, if the action is ready immediately for another operation
      • startOpCycle

        public abstract void startOpCycle​(TrackedOp<D> opc)
        Implementations that extend this base class can call this method in order to put an operation in flight.
        Parameters:
        opc - A tracked operation with state of parameterized type D
      • requestStop

        public void requestStop()
        Description copied from interface: Stoppable
        Ask this component to stop cycling. This is an asynchronous request. Once the current active cycle completes, the request will cause the component to stop cooperatively.
        Specified by:
        requestStop in interface Stoppable