@ThreadSafe
public final class SessionClientContext
extends Object
Holds a client context by keeping a reference to a server URI and by generating an identifying UUID.
The generated UUID is used to establish a relation between RMI server sessions and the client's context for socket creation. This is needed because the framework allows configurations where mutiple services are running within the same process, each with its own client / server properties.
Constructor and Description |
---|
SessionClientContext(RegistryEntry registryEntry,
Logger logger)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
ClientSecurityContext |
getSecurityContext()
Gets the security context.
|
String |
getServerName()
Gets the server name.
|
URI |
getServerURI()
Gets the server URI.
|
int |
getTimeout()
Gets the timeout.
|
UUID |
getUUID()
Gets the identifying UUID.
|
boolean |
isPrivate()
Asks if this context is private.
|
boolean |
isRemote()
Asks if the server is remote.
|
Remote |
lookup(String sessionMode)
Performs a lookup of the registry entry.
|
boolean |
register()
Registers itself.
|
void |
setTimeout(int timeout)
Sets the timeout.
|
boolean |
unregister()
Unregisters itself.
|
public SessionClientContext(@Nonnull RegistryEntry registryEntry, @Nonnull Logger logger)
registryEntry
- The registry entry.logger
- The logger instance to use.@Nonnull @CheckReturnValue public ClientSecurityContext getSecurityContext()
@Nonnull @CheckReturnValue public String getServerName()
@Nonnull @CheckReturnValue public URI getServerURI()
@Nonnegative @CheckReturnValue public int getTimeout()
@Nonnull @CheckReturnValue public UUID getUUID()
@CheckReturnValue public boolean isPrivate()
@CheckReturnValue public boolean isRemote()
@Nonnull @CheckReturnValue public Remote lookup(@Nonnull String sessionMode) throws AccessException, RemoteException, NotBoundException
sessionMode
- The session mode name.NotBoundException
- When the server name is not currently bound.RemoteException
- When the communication with the registry failed.AccessException
- When access is denied.public boolean register()
public void setTimeout(@Nonnegative int timeout)
timeout
- The timeout.public boolean unregister()
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.