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 aProcessState
initiated 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
-ProcessMetaData
for thisProcessState
.officeMetaData
-OfficeMetaData
.callback
- OptionalFlowCallback
. May benull
.callbackThreadState
- OptionalFlowCallback
ThreadState
. May benull
.threadLocalAwareExecutor
-ThreadLocalAwareExecutor
.profiler
- OptionalProfiler
. May benull
.initialSetup
- Initial setup withProcessState
before theProcessState
initialises.
-
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 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
.initialSetup
- Initial setup withProcessState
before theProcessState
initialises.
-
-
Method Detail
-
getProcessIdentifier
public ProcessIdentifier getProcessIdentifier()
Description copied from interface:ProcessState
Obtains theProcessIdentifier
for thisProcessState
.- Specified by:
getProcessIdentifier
in interfaceProcessState
- Returns:
ProcessIdentifier
for thisProcessState
.
-
getProcessManager
public ProcessManager getProcessManager()
Description copied from interface:ProcessState
Obtains theProcessManager
for thisProcessState
.- Specified by:
getProcessManager
in interfaceProcessState
- Returns:
ProcessManager
for thisProcessState
.
-
getOfficeManager
public OfficeManager getOfficeManager()
Description copied from interface:ProcessState
Obtains theOfficeManager
for thisProcessState
.- Specified by:
getOfficeManager
in interfaceProcessState
- Returns:
OfficeManager
for thisProcessState
.
-
getExecutor
public java.util.concurrent.Executor getExecutor()
Description copied from interface:ProcessState
Obtains theExecutor
for thisProcessState
.- Specified by:
getExecutor
in interfaceProcessState
- Returns:
Executor
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
.
-
-