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 aProcessState
initiated by aManagedObject
.
-
Method Summary
-
-
-
Constructor Detail
-
ProcessStateImpl
public ProcessStateImpl(ProcessMetaData processMetaData, OfficeMetaData officeMetaData, FlowCallback callback, ThreadState callbackThreadState, ThreadLocalAwareExecutor threadLocalAwareExecutor, Profiler profiler)
Initiate.- Parameters:
processMetaData
-ProcessMetaData
for thisProcessState
.officeMetaData
-OfficeMetaData
.callback
- OptionalFlowCallback
. May benull
.callbackThreadState
- OptionalFlowCallback
ThreadState
. 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 aProcessState
initiated by aManagedObject
.- Parameters:
processMetaData
-ProcessMetaData
for thisProcessState
.officeMetaData
-OfficeMetaData
.callback
- OptionalFlowCallback
. May benull
.callbackThreadState
- OptionalFlowCallback
ThreadState
. May benull
.threadLocalAwareExecutor
-ThreadLocalAwareExecutor
.profiler
- OptionalProfiler
. May benull
.inputManagedObject
-ManagedObject
that invoked thisProcessState
. May benull
.inputManagedObjectMetaData
-ManagedObjectMetaData
of the inputManagedObject
. Should the inputManagedObject
be provided this must be also provided.inputManagedObjectIndex
- Index of the inputManagedObject
within thisProcessState
.
-
-
Method Detail
-
getProcessIdentifier
public java.lang.Object getProcessIdentifier()
Description copied from interface:ProcessState
Obtains the identifier for thisProcessState
.- Specified by:
getProcessIdentifier
in interfaceProcessState
- Returns:
- Identifier for this
ProcessState
.
-
getProcessManager
public ProcessManager getProcessManager()
Description copied from interface:ProcessState
Obtains theProcessManager
for thisProcessState
.- Specified by:
getProcessManager
in interfaceProcessState
- Returns:
ProcessManager
for thisProcessState
.
-
isCancelled
public boolean isCancelled()
Description copied from interface:ProcessState
Indicates if the
ProcessState
has been cancelled.This is only valid after synchronising with this
ProcessState
(in other words the mainThreadState
).- Specified by:
isCancelled
in interfaceProcessState
- Returns:
true
if cancelled - or indeterminate if have not synchronised onProcessState
.
-
getMainThreadState
public ThreadState getMainThreadState()
Description copied from interface:ProcessState
Obtains the main
ThreadState
for thisProcessState
.The main
ThreadState
is used for anyProcessState
mutations. This avoids the possibility of data corruption, as only oneThreadState
may alter theProcessState
.- Specified by:
getMainThreadState
in interfaceProcessState
- Returns:
- Main
ThreadState
for thisProcessState
.
-
getManagedObjectCleanup
public ManagedObjectCleanup getManagedObjectCleanup()
Description copied from interface:ProcessState
Obtains theManagedObjectCleanup
for thisProcessState
.- Specified by:
getManagedObjectCleanup
in interfaceProcessState
- Returns:
ManagedObjectCleanup
for thisProcessState
.
-
spawnThreadState
public FunctionState spawnThreadState(ManagedFunctionMetaData<?,?> managedFunctionMetaData, java.lang.Object parameter, FlowCompletion completion, boolean isEscalationHandlingThreadState)
Description copied from interface:ProcessState
Spawns a newThreadState
contained in thisProcessState
.- Specified by:
spawnThreadState
in interfaceProcessState
- Parameters:
managedFunctionMetaData
-ManagedFunctionMetaData
of the initialManagedFunction
within the spawnedThreadState
.parameter
- Parameter for the initialManagedFunction
.completion
- OptionalFlowCompletion
to be notified of completion of the spawnedThreadState
.isEscalationHandlingThreadState
- Indicates whether theThreadState
is forEscalation
handling.- Returns:
FunctionState
to spawn theThreadState
.
-
threadComplete
public FunctionState threadComplete(ThreadState thread, FunctionState threadCompletion)
Description copied from interface:ProcessState
Flags that the inputThreadState
has complete.- Specified by:
threadComplete
in interfaceProcessState
- Parameters:
thread
-ThreadState
that has completed.threadCompletion
- OptionalFunctionState
for the completion of theThreadState
. May benull
.- Returns:
FunctionState
to complete theThreadState
.
-
getManagedObjectContainer
public ManagedObjectContainer getManagedObjectContainer(int index)
Description copied from interface:ProcessState
Obtains theManagedObjectContainer
for the input index.- Specified by:
getManagedObjectContainer
in interfaceProcessState
- Parameters:
index
- Index of theManagedObjectContainer
to be returned.- Returns:
ManagedObjectContainer
for the index.
-
getFunctionLoop
public FunctionLoop getFunctionLoop()
Description copied from interface:ProcessState
Obtains theFunctionLoop
for theProcessState
.- Specified by:
getFunctionLoop
in interfaceProcessState
- Returns:
FunctionLoop
for theProcessState
.
-
-