AbstractExecutor
The base class for all executors in CAMS.
Implements the Executor state machine. Subclasses only implement the callbacks onInitialize, onResume, onPause and onDispose; the lifecycle methods themselves cannot be overridden. A synchronous exception in a lifecycle method moves the executor to ExecutorState.Undefined.
- Implemented types
-
- Executor<
TConfig>
- Executor<
- Implementers
Constructors
AbstractExecutor
Properties
configuration
The configuration of this executor as set in initialize.
deployment
The deployment that this executor is part of executing.
measurements
The stream of Measurement collected by this executor.
samplingState
The runtime sampling state of this executor.
state
The runtime state of this executor.
stateEvents
The runtime state changes of this executor.
Methods
addError
- Object error, [
- StackTrace? stacktrace
Logs error as a warning and adds it to the measurements stream.
addMeasurement
- Measurement measurement
Adds measurement to the measurements stream.
dispose
Disposes this executor.
If not already paused, pause will be called first.
Once disposed, the executor cannot be used anymore and nothing will happen if any of the life cycle methods are called.
error
Moves this executor to ExecutorState.Undefined.
initialize
- TConfig configuration, [
- SmartphoneDeployment? deployment
Configures and initializes the executor. Call before resume.
onDispose
Callback when this executor is disposed.
Subclasses should override this, to implement any cleanup to be done before disposing.
onInitialize
Called by initialize. Returns true if successfully initialized.
If false, the executor stays in ExecutorState.Created. This is a synchronous method and must be light-weight.
onPause
Called by pause. Returns true if successfully paused.
If false, the state is not changed.
onResume
Called by resume. Returns true if successfully resumed.
If false, the executor moves to ExecutorState.PausedButShouldBeResumed.
pause
Pauses the executor until resume is called.
pauseButShouldBeResumed
Pauses the executor and marks it to be resumed later.
The state becomes ExecutorState.PausedButShouldBeResumed, e.g. when its device is temporarily disconnected.
resume
Starts or resumes the executor.
toString
A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.