net.sf.ehcache.distribution

Class ConfigurableRMIClientSocketFactory

public final class ConfigurableRMIClientSocketFactory extends Object implements Serializable, RMIClientSocketFactory

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.

Version: $Id: ConfigurableRMIClientSocketFactory.java 93 2006-05-22 07:09:27Z gregluck $

Author: Greg Luck

See Also: "http://java.sun.com/j2se/1.5.0/docs/guide/rmi/socketfactory/#1"

UNKNOWN: SerializableHasSerializationMethods,SerializableHasSerializationMethods

Constructor Summary
ConfigurableRMIClientSocketFactory(Integer socketTimeoutMillis)
Construct a new socket factory with the given timeout.
Method Summary
SocketcreateSocket(String host, int port)
Create a client socket connected to the specified host and port.
booleanequals(Object object)
The standard hashCode method which is necessary for SocketFactory classes.
inthashCode()
Implements the Object hashCode method.

Constructor Detail

ConfigurableRMIClientSocketFactory

public ConfigurableRMIClientSocketFactory(Integer socketTimeoutMillis)
Construct a new socket factory with the given timeout.

Parameters: socketTimeoutMillis

See Also: Socket#setSoTimeout

Method Detail

createSocket

public Socket createSocket(String host, int port)
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 the host name port the port number

Returns: a socket connected to the specified host and port.

Throws: java.io.IOException if an I/O error occurs during socket creation

Since: 1.2

equals

public boolean equals(Object object)
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 the comparison object

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

hashCode

public int hashCode()
Implements the Object hashCode method.

Returns: a hash based on socket options