Class StateManagerImpl
- java.lang.Object
-
- net.officefloor.frame.impl.execute.office.StateManagerImpl
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,StateManager
public class StateManagerImpl extends java.lang.Object implements StateManager
StateManager
implementation.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description StateManagerImpl(java.util.Map<java.lang.String,ManagedFunctionMetaData<?,?>> loadObjectMetaDatas, ThreadState threadState, MonitorClock monitorClock, java.util.function.Consumer<FunctionState> functionExecutor, java.lang.Runnable cleanUpState)
Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
<O> O
getObject(java.lang.String boundObjectName, long timeoutInMilliseconds)
Obtains the object for theManagedObject
synchronously.<O> void
load(java.lang.String boundObjectName, ObjectUser<O> user)
Loads the object from theManagedObject
asynchronously.
-
-
-
Constructor Detail
-
StateManagerImpl
public StateManagerImpl(java.util.Map<java.lang.String,ManagedFunctionMetaData<?,?>> loadObjectMetaDatas, ThreadState threadState, MonitorClock monitorClock, java.util.function.Consumer<FunctionState> functionExecutor, java.lang.Runnable cleanUpState)
Instantiate.- Parameters:
loadObjectMetaDatas
- Load objectManagedFunctionMetaData
instances by the loading object bound name.threadState
-ThreadState
for context of theManagedObject
instances.monitorClock
-MonitorClock
.functionExecutor
- Executes theFunctionState
instances.cleanUpState
- Cleans up state on closingStateManager
.
-
-
Method Detail
-
load
public <O> void load(java.lang.String boundObjectName, ObjectUser<O> user) throws UnknownObjectException
Description copied from interface:StateManager
Loads the object from theManagedObject
asynchronously.- Specified by:
load
in interfaceStateManager
- Parameters:
boundObjectName
- Bound name of theManagedObject
.user
-ObjectUser
to receive the loaded object (or possible failure).- Throws:
UnknownObjectException
- If unknown bound object name.
-
getObject
public <O> O getObject(java.lang.String boundObjectName, long timeoutInMilliseconds) throws java.lang.Throwable
Description copied from interface:StateManager
Obtains the object for theManagedObject
synchronously.- Specified by:
getObject
in interfaceStateManager
- Parameters:
boundObjectName
- Bound name of theManagedObject
.timeoutInMilliseconds
- Time out in milliseconds to wait for theManagedObject
creation.- Returns:
- Object.
- Throws:
UnknownObjectException
- If unknown bound object name.java.lang.Throwable
- If failure in obtaining the bound object.
-
close
public void close() throws java.lang.Exception
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.Exception
-
-