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, java.util.function.Consumer<ProcessState> initialSetup)Initiate.ProcessStateImpl(ProcessMetaData processMetaData, OfficeMetaData officeMetaData, FlowCallback callback, ThreadState callbackThreadState, ThreadLocalAwareExecutor threadLocalAwareExecutor, Profiler profiler, ManagedObject inputManagedObject, ManagedObjectMetaData<?> inputManagedObjectMetaData, int inputManagedObjectIndex, java.util.function.Consumer<ProcessState> initialSetup)Initiate for aProcessStateinitiated by aManagedObject.
-
Method Summary
-
-
-
Constructor Detail
-
ProcessStateImpl
public ProcessStateImpl(ProcessMetaData processMetaData, OfficeMetaData officeMetaData, FlowCallback callback, ThreadState callbackThreadState, ThreadLocalAwareExecutor threadLocalAwareExecutor, Profiler profiler, java.util.function.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, java.util.function.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 Detail
-
getProcessIdentifier
public ProcessIdentifier getProcessIdentifier()
Description copied from interface:ProcessStateObtains theProcessIdentifierfor thisProcessState.- Specified by:
getProcessIdentifierin interfaceProcessState- Returns:
ProcessIdentifierfor thisProcessState.
-
getProcessManager
public ProcessManager getProcessManager()
Description copied from interface:ProcessStateObtains theProcessManagerfor thisProcessState.- Specified by:
getProcessManagerin interfaceProcessState- Returns:
ProcessManagerfor thisProcessState.
-
getOfficeManager
public OfficeManager getOfficeManager()
Description copied from interface:ProcessStateObtains theOfficeManagerfor thisProcessState.- Specified by:
getOfficeManagerin interfaceProcessState- Returns:
OfficeManagerfor thisProcessState.
-
getExecutor
public java.util.concurrent.Executor 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
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.
-
-