Class ProcessStateImpl
- java.lang.Object
-
- net.officefloor.frame.impl.execute.process.ProcessStateImpl
-
- All Implemented Interfaces:
ProcessState
public class ProcessStateImpl extends java.lang.Object implements ProcessState
Implementation of theProcessState.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description ProcessStateImpl(ProcessMetaData processMetaData, OfficeMetaData officeMetaData, FlowCallback callback, ThreadState callbackThreadState, ThreadLocalAwareExecutor threadLocalAwareExecutor, Profiler profiler)Initiate.ProcessStateImpl(ProcessMetaData processMetaData, OfficeMetaData officeMetaData, FlowCallback callback, ThreadState callbackThreadState, ThreadLocalAwareExecutor threadLocalAwareExecutor, Profiler profiler, ManagedObject inputManagedObject, ManagedObjectMetaData<?> inputManagedObjectMetaData, int inputManagedObjectIndex)Initiate for aProcessStateinitiated by aManagedObject.
-
Method Summary
-
-
-
Constructor Detail
-
ProcessStateImpl
public ProcessStateImpl(ProcessMetaData processMetaData, OfficeMetaData officeMetaData, FlowCallback callback, ThreadState callbackThreadState, ThreadLocalAwareExecutor threadLocalAwareExecutor, Profiler profiler)
Initiate.- Parameters:
processMetaData-ProcessMetaDatafor thisProcessState.officeMetaData-OfficeMetaData.callback- OptionalFlowCallback. May benull.callbackThreadState- OptionalFlowCallbackThreadState. May benull.threadLocalAwareExecutor-ThreadLocalAwareExecutor.profiler- OptionalProfiler. May benull.
-
ProcessStateImpl
public ProcessStateImpl(ProcessMetaData processMetaData, OfficeMetaData officeMetaData, FlowCallback callback, ThreadState callbackThreadState, ThreadLocalAwareExecutor threadLocalAwareExecutor, Profiler profiler, ManagedObject inputManagedObject, ManagedObjectMetaData<?> inputManagedObjectMetaData, int inputManagedObjectIndex)
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.
-
-
Method Detail
-
getProcessIdentifier
public java.lang.Object getProcessIdentifier()
Description copied from interface:ProcessStateObtains the identifier for thisProcessState.- Specified by:
getProcessIdentifierin interfaceProcessState- Returns:
- Identifier for this
ProcessState.
-
getProcessManager
public ProcessManager getProcessManager()
Description copied from interface:ProcessStateObtains theProcessManagerfor thisProcessState.- Specified by:
getProcessManagerin interfaceProcessState- Returns:
ProcessManagerfor 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
public ThreadState 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
public ManagedObjectCleanup getManagedObjectCleanup()
Description copied from interface:ProcessStateObtains theManagedObjectCleanupfor thisProcessState.- Specified by:
getManagedObjectCleanupin interfaceProcessState- Returns:
ManagedObjectCleanupfor thisProcessState.
-
spawnThreadState
public FunctionState spawnThreadState(ManagedFunctionMetaData<?,?> managedFunctionMetaData, java.lang.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
public FunctionState threadComplete(ThreadState thread, FunctionState threadCompletion)
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
public ManagedObjectContainer getManagedObjectContainer(int index)
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
public FunctionLoop getFunctionLoop()
Description copied from interface:ProcessStateObtains theFunctionLoopfor theProcessState.- Specified by:
getFunctionLoopin interfaceProcessState- Returns:
FunctionLoopfor theProcessState.
-
-