Skip to content

ExecutorFactory

Creates and caches the trigger and task executors of all deployments.

A singleton used by TaskControlExecutor. Executors are cached per study deployment: task controls in the same deployment that share a trigger id or task name share one executor, while deployments never share executors.

Use getTaskExecutor to get or create a task executor. Use getTriggerExecutor to get an existing trigger executor, and createTriggerExecutor to create a new one with the registered TriggerFactorys. Sampling packages with their own triggers register a factory with registerTriggerFactory.

Constructors

ExecutorFactory

ExecutorFactory()

Returns the singleton ExecutorFactory.

Methods

createTriggerExecutor

TriggerExecutor<TriggerConfiguration>? createTriggerExecutor(
  1. String studyDeploymentId,
  2. int triggerId,
  3. TriggerConfiguration trigger
)

Creates a TriggerExecutor for trigger and caches it.

The cache key is studyDeploymentId and triggerId. Returns null if no registered TriggerFactory supports the runtime type of trigger.

dispose

void dispose()

Clears the cache of trigger and task executors.

The executors themselves are not disposed.

getTaskExecutor

TaskExecutor<TaskConfiguration>? getTaskExecutor(
  1. String studyDeploymentId,
  2. TaskConfiguration task
)

Returns the TaskExecutor for task in studyDeploymentId.

Executors are keyed by task name. Creates one if needed: a BackgroundTaskExecutor, AppTaskExecutor or FunctionTaskExecutor depending on the task type. Returns null if the type of task is unknown.

getTriggerExecutor

TriggerExecutor<TriggerConfiguration>? getTriggerExecutor(
  1. String studyDeploymentId,
  2. int triggerId
)

Returns the cached TriggerExecutor for triggerId, or null if none.

Executors are cached per studyDeploymentId.

registerTriggerFactory

void registerTriggerFactory(
  1. TriggerFactory factory
)

Registers factory for all trigger types in TriggerFactory.types.

Also calls TriggerFactory.onRegister. A later factory for the same type replaces an earlier one. Used by createTriggerExecutor.