Class BaseAsyncAction<D,​A extends Activity>

java.lang.Object
io.nosqlbench.engine.api.activityapi.core.BaseAsyncAction<D,​A>
Type Parameters:
D - An type of state holder for an operation, holding everything unique to that cycle and operation
A - An type of of an Activity, a state holder for a runtime instance of an Activity
All Implemented Interfaces:
Action, ActivityDefObserver, AsyncAction<D>, Stoppable

public abstract class BaseAsyncAction<D,​A extends Activity>
extends java.lang.Object
implements AsyncAction<D>, Stoppable, ActivityDefObserver
  • 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​(io.nosqlbench.engine.api.activityimpl.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.nosqlbench.engine.api.activityapi.core.Action

    init

    Methods inherited from interface io.nosqlbench.engine.api.activityapi.core.AsyncAction

    getOpInitFunction
  • Field Details

  • Constructor Details

  • Method Details

    • onActivityDefUpdate

      public void onActivityDefUpdate​(io.nosqlbench.engine.api.activityimpl.ActivityDef activityDef)
      Specified by:
      onActivityDefUpdate in interface ActivityDefObserver
    • 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. Implementations should call either TrackedOp.skip(int) or TrackedOp.start()}.
      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