Represents a session object used by IceGrid clients to allocate and release objects. Client sessions are created
either via the
RegistryPrx
object or via the registry client SessionManagerPrx
object.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.zeroc.Ice.Object
Object.Ice_invokeResult
-
Method Summary
Modifier and TypeMethodDescriptionallocateObjectByIdAsync
(Identity id, Current current) Allocates an object.allocateObjectByTypeAsync
(String type, Current current) Allocates an object with the given type.default CompletionStage<OutgoingResponse>
dispatch
(IncomingRequest request) Dispatches an incoming request to one of the methods of this generated interface, based on the operation name carried by the request.static String
Gets the type ID of the associated Slice interface.void
Keeps the session alive.void
releaseObject
(Identity id, Current current) Releases an object that was allocated usingSessionPrx.allocateObjectById(com.zeroc.Ice.Identity)
orSessionPrx.allocateObjectByType(java.lang.String)
.void
setAllocationTimeout
(int timeout, Current current) Sets the allocation timeout.
-
Method Details
-
keepAlive
Keeps the session alive.- Parameters:
current
- The Current object of the incoming request.
-
allocateObjectByIdAsync
CompletionStage<ObjectPrx> allocateObjectByIdAsync(Identity id, Current current) throws ObjectNotRegisteredException, AllocationException Allocates an object.- Parameters:
id
- The identity of the object to allocate.current
- The Current object of the incoming request.- Returns:
- A proxy to the allocated object. This proxy is never null.
- Throws:
AllocationException
- Thrown when the allocation fails.ObjectNotRegisteredException
- Thrown when an object with the given identity is not registered with the registry.- See Also:
-
allocateObjectByTypeAsync
CompletionStage<ObjectPrx> allocateObjectByTypeAsync(String type, Current current) throws AllocationException Allocates an object with the given type.- Parameters:
type
- The type of the object.current
- The Current object of the incoming request.- Returns:
- A proxy to the allocated object. This proxy is never null.
- Throws:
AllocationException
- Thrown when the allocation fails.- See Also:
-
releaseObject
void releaseObject(Identity id, Current current) throws ObjectNotRegisteredException, AllocationException Releases an object that was allocated usingSessionPrx.allocateObjectById(com.zeroc.Ice.Identity)
orSessionPrx.allocateObjectByType(java.lang.String)
.- Parameters:
id
- The identity of the object to release.current
- The Current object of the incoming request.- Throws:
AllocationException
- Thrown when the object can't be released. This can happen when the object is not allocatable or is not allocated by this session.ObjectNotRegisteredException
- Thrown when an object with the given identity is not registered with the registry.
-
setAllocationTimeout
Sets the allocation timeout. When no object is immediately available for an allocation request, the implementation ofSessionPrx.allocateObjectById(com.zeroc.Ice.Identity)
andSessionPrx.allocateObjectByType(java.lang.String)
waits for the duration of thistimeout
.- Parameters:
timeout
- The timeout in milliseconds.current
- The Current object of the incoming request.
-
ice_staticId
Gets the type ID of the associated Slice interface.- Returns:
- the string "::IceGrid::Session"
-
dispatch
Dispatches an incoming request to one of the methods of this generated interface, based on the operation name carried by the request.- Specified by:
dispatch
in interfaceObject
- Specified by:
dispatch
in interfaceSession
- Parameters:
request
- the incoming request- Returns:
- the outgoing response
- Throws:
UserException
- if aUserException
is thrown, Ice will marshal it as the response payload.
-