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
StateManagerimplementation.- 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 voidclose()<O> OgetObject(java.lang.String boundObjectName, long timeoutInMilliseconds)Obtains the object for theManagedObjectsynchronously.<O> voidload(java.lang.String boundObjectName, ObjectUser<O> user)Loads the object from theManagedObjectasynchronously.
-
-
-
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 objectManagedFunctionMetaDatainstances by the loading object bound name.threadState-ThreadStatefor context of theManagedObjectinstances.monitorClock-MonitorClock.functionExecutor- Executes theFunctionStateinstances.cleanUpState- Cleans up state on closingStateManager.
-
-
Method Detail
-
load
public <O> void load(java.lang.String boundObjectName, ObjectUser<O> user) throws UnknownObjectExceptionDescription copied from interface:StateManagerLoads the object from theManagedObjectasynchronously.- Specified by:
loadin interfaceStateManager- Parameters:
boundObjectName- Bound name of theManagedObject.user-ObjectUserto 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.ThrowableDescription copied from interface:StateManagerObtains the object for theManagedObjectsynchronously.- Specified by:
getObjectin interfaceStateManager- Parameters:
boundObjectName- Bound name of theManagedObject.timeoutInMilliseconds- Time out in milliseconds to wait for theManagedObjectcreation.- 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:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
-