Class SafeManagedObjectService<F extends java.lang.Enum<F>>
- java.lang.Object
-
- net.officefloor.frame.impl.execute.service.SafeManagedObjectService<F>
-
- All Implemented Interfaces:
ManagedObjectServiceContext<F>
public class SafeManagedObjectService<F extends java.lang.Enum<F>> extends java.lang.Object implements ManagedObjectServiceContext<F>
Wraps the set up of theManagedObjectService
to block invocations until available.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SafeManagedObjectService.ProcessInvoker<F extends java.lang.Enum<F>>
Invokes theProcessState
from theManagedObjectServiceContext
.static interface
SafeManagedObjectService.SafeServicer<F extends java.lang.Enum<F>,T extends java.lang.Exception>
Safely invokes service on theManagedObjectServiceContext
.
-
Constructor Summary
Constructors Constructor Description SafeManagedObjectService(ManagedObjectExecuteContext<F> executeContext)
InitiateManagedObjectExecuteContext
.SafeManagedObjectService(ManagedObjectExecuteContext<F> executeContext, SafeManagedObjectService.SafeServicer<F,? extends java.lang.Exception> startup)
InitiateManagedObjectExecuteContext
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessManager
invokeProcess(int flowIndex, java.lang.Object parameter, ManagedObject managedObject, long delay, FlowCallback callback)
Instigates aProcessState
.ProcessManager
invokeProcess(F key, java.lang.Object parameter, ManagedObject managedObject, long delay, FlowCallback callback)
Instigates aProcessState
.ProcessManager
invokeProcess(SafeManagedObjectService.ProcessInvoker<F> invoker)
Enables genericProcessState
invocation.<T extends java.lang.Exception>
booleanservice(SafeManagedObjectService.SafeServicer<F,T> servicer)
Undertakes servicing.
-
-
-
Constructor Detail
-
SafeManagedObjectService
public SafeManagedObjectService(ManagedObjectExecuteContext<F> executeContext)
InitiateManagedObjectExecuteContext
.- Parameters:
executeContext
-ManagedObjectExecuteContext
.
-
SafeManagedObjectService
public SafeManagedObjectService(ManagedObjectExecuteContext<F> executeContext, SafeManagedObjectService.SafeServicer<F,? extends java.lang.Exception> startup)
InitiateManagedObjectExecuteContext
.- Parameters:
executeContext
-ManagedObjectExecuteContext
.startup
- Start upSafeManagedObjectService.SafeServicer
.
-
-
Method Detail
-
service
public <T extends java.lang.Exception> boolean service(SafeManagedObjectService.SafeServicer<F,T> servicer) throws T extends java.lang.Exception, java.lang.InterruptedException
Undertakes servicing.- Parameters:
servicer
- Logic for servicing.- Returns:
true
if servicing invoked.false
is stopped servicing.- Throws:
T
-SafeManagedObjectService.SafeServicer
possible failure.java.lang.InterruptedException
- If failed to waiting for servicing.T extends java.lang.Exception
-
invokeProcess
public ProcessManager invokeProcess(SafeManagedObjectService.ProcessInvoker<F> invoker)
Enables genericProcessState
invocation.- Parameters:
invoker
-SafeManagedObjectService.ProcessInvoker
.- Returns:
ProcessManager
of the invokedProcessState
.
-
invokeProcess
public ProcessManager invokeProcess(F key, java.lang.Object parameter, ManagedObject managedObject, long delay, FlowCallback callback) throws java.lang.IllegalArgumentException
Description copied from interface:ManagedObjectServiceContext
Instigates aProcessState
.- Specified by:
invokeProcess
in interfaceManagedObjectServiceContext<F extends java.lang.Enum<F>>
- Parameters:
key
- Key identifying theFlow
to instigate.parameter
- Parameter to firstManagedFunction
of theFlow
.managedObject
-ManagedObject
for theProcessState
of theFlow
.delay
- Delay in milliseconds before theFlow
is invoked. A0
or negative value invokes theFlow
immediately.callback
-FlowCallback
on completion of theFlow
.- Returns:
ProcessManager
for theProcessState
.- Throws:
java.lang.IllegalArgumentException
- If- unknown
Flow
key - parameter is incorrect type
- no
ManagedObject
is supplied
- unknown
-
invokeProcess
public ProcessManager invokeProcess(int flowIndex, java.lang.Object parameter, ManagedObject managedObject, long delay, FlowCallback callback) throws java.lang.IllegalArgumentException
Description copied from interface:ManagedObjectServiceContext
Instigates aProcessState
.- Specified by:
invokeProcess
in interfaceManagedObjectServiceContext<F extends java.lang.Enum<F>>
- Parameters:
flowIndex
- Index identifying theFlow
to instigate.parameter
- Parameter that to the firstManagedFunction
of theFlow
.managedObject
-ManagedObject
for theProcessState
of theFlow
.delay
- Delay in milliseconds before theFlow
is invoked. A0
or negative value invokes theFlow
immediately.callback
-FlowCallback
on completion of theFlow
.- Returns:
ProcessManager
for theProcessState
.- Throws:
java.lang.IllegalArgumentException
- If- unknown
Flow
index - parameter is incorrect type
- no
ManagedObject
is supplied
- unknown
-
-