Package omero.cmd
Class HandleI
- java.lang.Object
-
- omero.cmd.HandleI
-
- All Implemented Interfaces:
java.lang.Runnable,_HandleOperations,IHandle,SessionAware,CloseableServant
public class HandleI extends java.lang.Object implements _HandleOperations, IHandle, SessionAware
Servant for the handle proxy from the Command API. This is also aRunnableand is passed to a ThreadPool instanceTransitions: +------------------o [FINISHED] | o | | (CREATED) ---o READY o===o RUNNING o===o CANCELLING ---o [CANCELLED] | | o o | |---------------------------| | +--------------------------------------------------------+- Since:
- 4.3.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHandleI.Cancel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCallback(CmdCallbackPrx cb, Ice.Current __current)Add a callback for notifications.booleancancel(Ice.Current __current)Attempts to cancel execution of thisRequest.voidclose(Ice.Current current)Closes this handle.RequestgetRequest(Ice.Current __current)Returns the request object that was used to initialize this handle.ResponsegetResponse(Ice.Current __current)Returns a response if this handle has finished execution, otherwise returns null.StatusgetStatus(Ice.Current __current)Returns a status object for the current execution.voidinitialize(Ice.Identity id, IRequest req, java.util.Map<java.lang.String,java.lang.String> ctx)Must be called on all instances exactly once before processing.voidnotifyCallbacks()Calls the proper notification on all callbacks based on the current position in the state diagram.voidremoveCallback(CmdCallbackPrx cb, Ice.Current __current)Remove callback for notifications.voidrun()NB: Executes only if atCREATEDin the state diagram.voidsetSession(SessionI session)java.util.List<java.lang.Object>steps(ome.util.SqlAction sql, org.hibernate.Session session, ome.system.ServiceFactory sf)
-
-
-
Constructor Detail
-
HandleI
@Deprecated public HandleI(int cancelTimeoutMs)
Deprecated.
-
HandleI
public HandleI(ome.services.util.ReadOnlyStatus readOnly, int cancelTimeoutMs)Create aHandleI(atCREATEDin the state diagram) with the given cancel timeout in milliseconds.- Parameters:
readOnly- the read-only statuscancelTimeoutMs- the cancel timeout (in milliseconds)
-
-
Method Detail
-
setSession
public void setSession(SessionI session) throws ServerError
- Specified by:
setSessionin interfaceSessionAware- Throws:
ServerError
-
initialize
public void initialize(Ice.Identity id, IRequest req, java.util.Map<java.lang.String,java.lang.String> ctx)Description copied from interface:IHandleMust be called on all instances exactly once before processing.- Specified by:
initializein interfaceIHandle- Parameters:
id- Ice identity of this instance. Cannot be null.req- Request to be processed. Must also be anRequestinstance.ctx- Possibly null call context which will be passed toExecutor.execute(Map, ome.system.Principal, ome.services.util.Executor.Work)
-
addCallback
public void addCallback(CmdCallbackPrx cb, Ice.Current __current)
Description copied from interface:_HandleOperationsAdd a callback for notifications.- Specified by:
addCallbackin interface_HandleOperations__current- The Current object for the invocation.
-
removeCallback
public void removeCallback(CmdCallbackPrx cb, Ice.Current __current)
Description copied from interface:_HandleOperationsRemove callback for notifications.- Specified by:
removeCallbackin interface_HandleOperations__current- The Current object for the invocation.
-
notifyCallbacks
public void notifyCallbacks()
Calls the proper notification on all callbacks based on the current position in the state diagram. If that is anything other thanCANCELLEDorFINISHEDthenCmdCallbackPrx.step(int, int)is called.
-
getRequest
public Request getRequest(Ice.Current __current)
Description copied from interface:_HandleOperationsReturns the request object that was used to initialize this handle. Never null.- Specified by:
getRequestin interface_HandleOperations- Parameters:
__current- The Current object for the invocation.
-
getResponse
public Response getResponse(Ice.Current __current)
Description copied from interface:_HandleOperationsReturns a response if this handle has finished execution, otherwise returns null.- Specified by:
getResponsein interface_HandleOperations- Parameters:
__current- The Current object for the invocation.
-
getStatus
public Status getStatus(Ice.Current __current)
Description copied from interface:_HandleOperationsReturns a status object for the current execution. This will likely be the same object that would be returned as a component of theResponsevalue. Never null.- Specified by:
getStatusin interface_HandleOperations- Parameters:
__current- The Current object for the invocation.
-
cancel
public boolean cancel(Ice.Current __current) throws LockTimeoutDescription copied from interface:_HandleOperationsAttempts to cancel execution of thisRequest. Returns true if cancellation was successful. Returns false if not, in which case likely this request will run to completion.- Specified by:
cancelin interface_HandleOperations- Parameters:
__current- The Current object for the invocation.- Throws:
LockTimeout
-
close
public void close(Ice.Current current)
Description copied from interface:_HandleOperationsCloses this handle. If the request is running, then a cancellation will be attempted first. All uses of a handle should be surrounded by a try/finally close block.- Specified by:
closein interface_HandleOperations- Specified by:
closein interfaceCloseableServant- Parameters:
current- The Current object for the invocation.
-
run
public void run()
NB: Executes only if atCREATEDin the state diagram.- Specified by:
runin interfacejava.lang.Runnable
-
steps
public java.util.List<java.lang.Object> steps(ome.util.SqlAction sql, org.hibernate.Session session, ome.system.ServiceFactory sf) throws HandleI.Cancel- Throws:
HandleI.Cancel
-
-