Class CoreMotor<D>
java.lang.Object
io.nosqlbench.engine.api.activityimpl.motor.CoreMotor<D>
- All Implemented Interfaces:
ActivityDefObserver,Motor<D>,Stoppable,Runnable
ActivityMotor is a Runnable which runs in one of an activity's many threads.
It is the iteration harness for individual cycles of an activity. Each ActivityMotor
instance is responsible for taking input from a LongSupplier and applying
the provided LongConsumer to it on each cycle. These two parameters are called
input and action, respectively.
This motor implementation splits the handling of sync and async actions with a hard
fork in the middle to limit potential breakage of the prior sync implementation
with new async logic.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an ActivityMotor.Create an ActivityMotor.Create an ActivityMotor. -
Method Summary
Modifier and TypeMethodDescriptiongetInput()longget the slotId which this motor is assigned to within the activity instance.getState()Get a description of the current slot run status.voidonActivityDefUpdate(ActivityDef activityDef) voidvoidAsk this component to stop cycling.voidrun()Set the action for this ActivityMotor.Set the input for this ActivityMotor.voidsetResultOutput(Output resultOutput) toString()
-
Constructor Details
-
CoreMotor
-
CoreMotor
Create an ActivityMotor.- Parameters:
activity- The activity that this motor is based on.slotId- The enumeration of the motor, as assigned by its executor.input- A LongSupplier which provides the cycle number inputs.action- An LongConsumer which is applied to the input for each cycle.
-
CoreMotor
Create an ActivityMotor.- Parameters:
activity- The activity that this motor is based on.slotId- The enumeration of the motor, as assigned by its executor.input- A LongSupplier which provides the cycle number inputs.action- An LongConsumer which is applied to the input for each cycle.output- An optional opTracker.
-
-
Method Details
-
setInput
-
getInput
-
setAction
-
getAction
-
getSlotId
-
getState
-
removeState
public void removeState()- Specified by:
removeStatein interfaceMotor<D>
-
run
-
toString
-
onActivityDefUpdate
- Specified by:
onActivityDefUpdatein interfaceActivityDefObserver
-
requestStop
public void requestStop()Description copied from interface:StoppableAsk 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:
requestStopin interfaceStoppable
-
setResultOutput
-