Package net.sf.ehcache.distribution
Class ConfigurableRMIClientSocketFactory
java.lang.Object
net.sf.ehcache.distribution.ConfigurableRMIClientSocketFactory
- All Implemented Interfaces:
Serializable
,RMIClientSocketFactory
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$
- Author:
- Greg Luck
- See Also:
-
Constructor Summary
ConstructorDescriptionConfigurableRMIClientSocketFactory
(Integer socketTimeoutMillis) Construct a new socket factory with the given timeout. -
Method Summary
Modifier and TypeMethodDescriptioncreateSocket
(String host, int port) Create a client socket connected to the specified host and port.boolean
The standard hashCode method which is necessary for SocketFactory classes.static RMISocketFactory
Return the JVM-level configuredRMISocketFactory
.int
hashCode()
Implements the Object hashCode method.
-
Constructor Details
-
ConfigurableRMIClientSocketFactory
Construct a new socket factory with the given timeout.- Parameters:
socketTimeoutMillis
-- See Also:
-
-
Method Details
-
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);
- Specified by:
createSocket
in interfaceRMIClientSocketFactory
- Parameters:
host
- the host nameport
- the port number- Returns:
- a socket connected to the specified host and port.
- Throws:
IOException
- if an I/O error occurs during socket creation- Since:
- 1.2
-
hashCode
public int hashCode()Implements the Object hashCode method. -
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. -
getConfiguredRMISocketFactory
Return the JVM-level configuredRMISocketFactory
.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 byRMISocketFactory.getDefaultSocketFactory()
is used instead.- Returns:
- the configured @{code
RMISocketFactory
-