Class ProcessStateImpl
java.lang.Object
net.officefloor.frame.impl.execute.process.ProcessStateImpl
- All Implemented Interfaces:
ProcessState
Implementation of the
ProcessState.- Author:
- Daniel Sagenschneider
-
Constructor Summary
ConstructorsConstructorDescriptionProcessStateImpl(ProcessMetaData processMetaData, OfficeMetaData officeMetaData, FlowCallback callback, ThreadState callbackThreadState, ThreadLocalAwareExecutor threadLocalAwareExecutor, Profiler profiler, Consumer<ProcessState> initialSetup) Initiate.ProcessStateImpl(ProcessMetaData processMetaData, OfficeMetaData officeMetaData, FlowCallback callback, ThreadState callbackThreadState, ThreadLocalAwareExecutor threadLocalAwareExecutor, Profiler profiler, ManagedObject inputManagedObject, ManagedObjectMetaData<?> inputManagedObjectMetaData, int inputManagedObjectIndex, Consumer<ProcessState> initialSetup) Initiate for aProcessStateinitiated by aManagedObject. -
Method Summary
Modifier and TypeMethodDescriptionObtains theExecutorfor thisProcessState.Obtains theFunctionLoopfor theProcessState.Obtains the mainThreadStatefor thisProcessState.Obtains theManagedObjectCleanupfor thisProcessState.getManagedObjectContainer(int index) Obtains theManagedObjectContainerfor the input index.Obtains theOfficeManagerfor thisProcessState.Obtains theProcessIdentifierfor thisProcessState.Obtains theProcessManagerfor thisProcessState.booleanIndicates if theProcessStatehas been cancelled.spawnThreadState(ManagedFunctionMetaData<?, ?> managedFunctionMetaData, Object parameter, FlowCompletion completion, boolean isEscalationHandlingThreadState) Spawns a newThreadStatecontained in thisProcessState.threadComplete(ThreadState thread, FunctionState threadCompletion) Flags that the inputThreadStatehas complete.
-
Constructor Details
-
ProcessStateImpl
public ProcessStateImpl(ProcessMetaData processMetaData, OfficeMetaData officeMetaData, FlowCallback callback, ThreadState callbackThreadState, ThreadLocalAwareExecutor threadLocalAwareExecutor, Profiler profiler, Consumer<ProcessState> initialSetup) Initiate.- Parameters:
processMetaData-ProcessMetaDatafor thisProcessState.officeMetaData-OfficeMetaData.callback- OptionalFlowCallback. May benull.callbackThreadState- OptionalFlowCallbackThreadState. May benull.threadLocalAwareExecutor-ThreadLocalAwareExecutor.profiler- OptionalProfiler. May benull.initialSetup- Initial setup withProcessStatebefore theProcessStateinitialises.
-
ProcessStateImpl
public ProcessStateImpl(ProcessMetaData processMetaData, OfficeMetaData officeMetaData, FlowCallback callback, ThreadState callbackThreadState, ThreadLocalAwareExecutor threadLocalAwareExecutor, Profiler profiler, ManagedObject inputManagedObject, ManagedObjectMetaData<?> inputManagedObjectMetaData, int inputManagedObjectIndex, Consumer<ProcessState> initialSetup) Initiate for aProcessStateinitiated by aManagedObject.- Parameters:
processMetaData-ProcessMetaDatafor thisProcessState.officeMetaData-OfficeMetaData.callback- OptionalFlowCallback. May benull.callbackThreadState- OptionalFlowCallbackThreadState. May benull.threadLocalAwareExecutor-ThreadLocalAwareExecutor.profiler- OptionalProfiler. May benull.inputManagedObject-ManagedObjectthat invoked thisProcessState. May benull.inputManagedObjectMetaData-ManagedObjectMetaDataof the inputManagedObject. Should the inputManagedObjectbe provided this must be also provided.inputManagedObjectIndex- Index of the inputManagedObjectwithin thisProcessState.initialSetup- Initial setup withProcessStatebefore theProcessStateinitialises.
-
-
Method Details
-
getProcessIdentifier
Description copied from interface:ProcessStateObtains theProcessIdentifierfor thisProcessState.- Specified by:
getProcessIdentifierin interfaceProcessState- Returns:
ProcessIdentifierfor thisProcessState.
-
getProcessManager
Description copied from interface:ProcessStateObtains theProcessManagerfor thisProcessState.- Specified by:
getProcessManagerin interfaceProcessState- Returns:
ProcessManagerfor thisProcessState.
-
getOfficeManager
Description copied from interface:ProcessStateObtains theOfficeManagerfor thisProcessState.- Specified by:
getOfficeManagerin interfaceProcessState- Returns:
OfficeManagerfor thisProcessState.
-
getExecutor
Description copied from interface:ProcessStateObtains theExecutorfor thisProcessState.- Specified by:
getExecutorin interfaceProcessState- Returns:
Executorfor thisProcessState.
-
isCancelled
public boolean isCancelled()Description copied from interface:ProcessStateIndicates if the
ProcessStatehas been cancelled.This is only valid after synchronising with this
ProcessState(in other words the mainThreadState).- Specified by:
isCancelledin interfaceProcessState- Returns:
trueif cancelled - or indeterminate if have not synchronised onProcessState.
-
getMainThreadState
Description copied from interface:ProcessStateObtains the main
ThreadStatefor thisProcessState.The main
ThreadStateis used for anyProcessStatemutations. This avoids the possibility of data corruption, as only oneThreadStatemay alter theProcessState.- Specified by:
getMainThreadStatein interfaceProcessState- Returns:
- Main
ThreadStatefor thisProcessState.
-
getManagedObjectCleanup
Description copied from interface:ProcessStateObtains theManagedObjectCleanupfor thisProcessState.- Specified by:
getManagedObjectCleanupin interfaceProcessState- Returns:
ManagedObjectCleanupfor thisProcessState.
-
spawnThreadState
public FunctionState spawnThreadState(ManagedFunctionMetaData<?, ?> managedFunctionMetaData, Object parameter, FlowCompletion completion, boolean isEscalationHandlingThreadState) Description copied from interface:ProcessStateSpawns a newThreadStatecontained in thisProcessState.- Specified by:
spawnThreadStatein interfaceProcessState- Parameters:
managedFunctionMetaData-ManagedFunctionMetaDataof the initialManagedFunctionwithin the spawnedThreadState.parameter- Parameter for the initialManagedFunction.completion- OptionalFlowCompletionto be notified of completion of the spawnedThreadState.isEscalationHandlingThreadState- Indicates whether theThreadStateis forEscalationhandling.- Returns:
FunctionStateto spawn theThreadState.
-
threadComplete
Description copied from interface:ProcessStateFlags that the inputThreadStatehas complete.- Specified by:
threadCompletein interfaceProcessState- Parameters:
thread-ThreadStatethat has completed.threadCompletion- OptionalFunctionStatefor the completion of theThreadState. May benull.- Returns:
FunctionStateto complete theThreadState.
-
getManagedObjectContainer
Description copied from interface:ProcessStateObtains theManagedObjectContainerfor the input index.- Specified by:
getManagedObjectContainerin interfaceProcessState- Parameters:
index- Index of theManagedObjectContainerto be returned.- Returns:
ManagedObjectContainerfor the index.
-
getFunctionLoop
Description copied from interface:ProcessStateObtains theFunctionLoopfor theProcessState.- Specified by:
getFunctionLoopin interfaceProcessState- Returns:
FunctionLoopfor theProcessState.
-