Top Description Fields Constructors Methods
net.sf.ehcache.distribution

public final Class ConfigurableRMIClientSocketFactory

extends Object
implements Serializable, RMIClientSocketFactory
Class Inheritance
All Implemented Interfaces
java.rmi.server.RMIClientSocketFactory, java.io.Serializable
Imports
java.io.IOException, .Serializable, java.net.Socket, java.rmi.server.RMIClientSocketFactory, .RMISocketFactory

Default socket timeouts are unlikely to be suitable for cache replication. Sockets should fail fast.

This class decorates the RMIClientSocketFactory so as to enable customisations to be placed on newly created sockets.

Author
Greg Luck
Version
$Id: ConfigurableRMIClientSocketFactory.java 10789 2018-04-26 02:08:13Z adahanne $

Field Summary

Modifier and TypeField and Description
private static final int
private static final long
private final int

Constructor Summary

AccessConstructor and Description
public
ConfigurableRMIClientSocketFactory(Integer socketTimeoutMillis)

Construct a new socket factory with the given timeout.

Method Summary

Modifier and TypeMethod and Description
public Socket

Returns:

a socket connected to the specified host and port.
createSocket
(String
the host name
host
,
int
the port number
port
)

Implements java.rmi.server.RMIClientSocketFactory.createSocket.

Create a client socket connected to the specified host and port.
public boolean

Returns:

equal if the classes are the same and the socket options are the name.
equals
(Object
the comparison object
object
)

Overrides java.lang.Object.equals.

The standard hashCode method which is necessary for SocketFactory classes.
public static RMISocketFactory

Returns:

the configured @{code RMISocketFactory
getConfiguredRMISocketFactory
()

Return the JVM-level configured RMISocketFactory.

public int

Returns:

a hash based on socket options
hashCode
()

Overrides java.lang.Object.hashCode.

Implements the Object hashCode method.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

ONE_SECONDback to summary
private static final int ONE_SECOND
serialVersionUIDback to summary
private static final long serialVersionUID
socketTimeoutMillisback to summary
private final int socketTimeoutMillis

Constructor Detail

ConfigurableRMIClientSocketFactoryback to summary
public ConfigurableRMIClientSocketFactory(Integer socketTimeoutMillis)

Construct a new socket factory with the given timeout.

See Also
Socket#setSoTimeout

Method Detail

createSocketback to summary
public Socket createSocket(String host, int port) throws IOException

Implements java.rmi.server.RMIClientSocketFactory.createSocket.

Create a client socket connected to the specified host and port.

If necessary this implementation can be changed to specify the outbound address to use e.g. Socket socket = new Socket(host, port, localInterface , 0);

Parameters
host:String

the host name

port:int

the port number

Returns:Socket

a socket connected to the specified host and port.

Exceptions
IOException:
if an I/O error occurs during socket creation
Since
1.2
equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

The standard hashCode method which is necessary for SocketFactory classes. Omitting this method causes RMI to quickly error out with "too many open files" errors.

Parameters
object:Object

the comparison object

Returns:boolean

equal if the classes are the same and the socket options are the name.

Annotations
@Override
getConfiguredRMISocketFactoryback to summary
public static RMISocketFactory getConfiguredRMISocketFactory()

Return the JVM-level configured RMISocketFactory.

If a global socket factory has been set via the RMISocketFactory#setSocketFactory(RMISocketFactory) method then that factory will be returned. Otherwise the default socket factory as returned by RMISocketFactory#getDefaultSocketFactory() is used instead.

Returns:RMISocketFactory

the configured @{code RMISocketFactory

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements the Object hashCode method.

Returns:int

a hash based on socket options

Annotations
@Override