@ThreadSafe
public class ClientSocketFactory
extends Object
implements RMIClientSocketFactory, Serializable
This implementation of RMIClientSocketFactory
uses the
UUID
provided by a ClientSecurityContext
to get the security
informations needed to create Socket
s. The association is done by a
call to the static register(org.rvpf.base.rmi.SessionClientContext)
method by the
ClientSecurityContext
itself before the connection to a server
object.
This socket factory is created for each new session and is not reused.
Constructor and Description |
---|
ClientSocketFactory(UUID uuid)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
Socket |
createSocket(String host,
int port) |
boolean |
equals(Object other) |
protected SessionClientContext |
getContext()
Gets the context.
|
int |
hashCode() |
protected Socket |
newSocket(String host,
int port)
Create a client socket connected to the specified host and port.
|
public ClientSocketFactory(@Nonnull UUID uuid)
uuid
- The UUID identifying the context.public final Socket createSocket(String host, int port) throws IOException
createSocket
in interface RMIClientSocketFactory
IOException
public final boolean equals(Object other)
equals
in class Object
public final int hashCode()
hashCode
in class Object
@Nonnull @CheckReturnValue protected SessionClientContext getContext() throws IOException
The context is cached to allow the RMI distributed garbage collector to still be able to connect to the server for 'clean' requests even after the context has been unregistered.
IOException
- If the context is unknown.@Nonnull @CheckReturnValue protected Socket newSocket(@Nonnull String host, int port) throws IOException
host
- The host name.port
- The port number.IOException
- When an I/O error occurs during socket creation.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.