springs.util
Class TimeoutRMISocketFactory

java.lang.Object
  |
  +--java.rmi.server.RMISocketFactory
        |
        +--springs.util.TimeoutRMISocketFactory
All Implemented Interfaces:
java.rmi.server.RMIClientSocketFactory, java.rmi.server.RMIServerSocketFactory

public class TimeoutRMISocketFactory
extends java.rmi.server.RMISocketFactory

A rmi socket factory that allows the specification of timeouts.

Author:
Sergio Ilarri Artigas

Field Summary
private  int _hash
           
private  int _millisTimeout
           
 
Fields inherited from class java.rmi.server.RMISocketFactory
 
Constructor Summary
TimeoutRMISocketFactory(int millisTimeout)
          Constructor.
 
Method Summary
 java.net.ServerSocket createServerSocket(int port)
           
 java.net.Socket createSocket(java.lang.String host, int port)
           
 boolean equals(java.lang.Object obj)
          For RMI to re-use sockets efficiently, an implementation of a socket factory must override equals and hashCode().
 int hashCode()
          For RMI to re-use sockets efficiently, an implementation of a socket factory must override equals and hashCode().
 
Methods inherited from class java.rmi.server.RMISocketFactory
getDefaultSocketFactory, getFailureHandler, getSocketFactory, setFailureHandler, setSocketFactory
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_millisTimeout

private int _millisTimeout

_hash

private int _hash
Constructor Detail

TimeoutRMISocketFactory

public TimeoutRMISocketFactory(int millisTimeout)
Constructor.

Parameters:
millisTimeout - the timeout for sockets connections.
Method Detail

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port)
                             throws java.io.IOException
Specified by:
createSocket in interface java.rmi.server.RMIClientSocketFactory
Specified by:
createSocket in class java.rmi.server.RMISocketFactory
java.io.IOException

createServerSocket

public java.net.ServerSocket createServerSocket(int port)
                                         throws java.io.IOException
Specified by:
createServerSocket in interface java.rmi.server.RMIServerSocketFactory
Specified by:
createServerSocket in class java.rmi.server.RMISocketFactory
java.io.IOException

equals

public boolean equals(java.lang.Object obj)
For RMI to re-use sockets efficiently, an implementation of a socket factory must override equals and hashCode(). Source: "Java RMI", by W. Grosso, O'reilly.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
For RMI to re-use sockets efficiently, an implementation of a socket factory must override equals and hashCode(). Source: "Java RMI", by W. Grosso, O'reilly.

Overrides:
hashCode in class java.lang.Object