Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jnp.interfaces
Class TimedSocketFactory  view TimedSocketFactory download TimedSocketFactory.java

java.lang.Object
  extended byjavax.net.SocketFactory
      extended byorg.jnp.interfaces.TimedSocketFactory

public class TimedSocketFactory
extends javax.net.SocketFactory

A concrete implementation of the SocketFactory that supports a configurable timeout for the initial socket connection as well as the SO_TIMEOUT used to determine how long a read will block waiting for data.

Version:
$Revision: 1.2 $

Nested Class Summary
(package private)  class TimedSocketFactory.ConnectThread
          A subclass of Thread used to time the blocking connect operation and notify the thread attempting the socket connect of a timeout.
 
Field Summary
static java.lang.String JNP_SO_TIMEOUT
           
static java.lang.String JNP_TIMEOUT
           
protected  int soTimeout
          The SO_TIMEOUT in milliseconds
protected  int timeout
          The connection timeout in milliseconds
 
Constructor Summary
TimedSocketFactory()
          Creates a new instance of TimedSocketFactory
TimedSocketFactory(java.util.Hashtable env)
           
 
Method Summary
 java.net.Socket createSocket(java.net.InetAddress hostAddr, int port)
          Creates a socket connected to a given host on a given port.
 java.net.Socket createSocket(java.net.InetAddress hostAddr, int port, java.net.InetAddress localAddr, int localPort)
          Creates a socket connected to a given host on a given port, connecting locally to the interface with the given address and port.
protected  java.net.Socket createSocket(java.net.InetAddress hostAddr, int port, java.net.InetAddress localAddr, int localPort, int connectTimeout)
           
 java.net.Socket createSocket(java.lang.String host, int port)
          Creates a socket connected to a given host on a given port.
 java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress localAddr, int localPort)
          Creates a socket connected to a given host on a given port, connecting locally to the interface with the given address and port.
 
Methods inherited from class javax.net.SocketFactory
createSocket, getDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JNP_TIMEOUT

public static final java.lang.String JNP_TIMEOUT
See Also:
Constant Field Values

JNP_SO_TIMEOUT

public static final java.lang.String JNP_SO_TIMEOUT
See Also:
Constant Field Values

timeout

protected int timeout
The connection timeout in milliseconds


soTimeout

protected int soTimeout
The SO_TIMEOUT in milliseconds

Constructor Detail

TimedSocketFactory

public TimedSocketFactory()
Creates a new instance of TimedSocketFactory


TimedSocketFactory

public TimedSocketFactory(java.util.Hashtable env)
Method Detail

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port)
                             throws java.io.IOException,
                                    java.net.UnknownHostException
Description copied from class: javax.net.SocketFactory
Creates a socket connected to a given host on a given port.


createSocket

public java.net.Socket createSocket(java.net.InetAddress hostAddr,
                                    int port)
                             throws java.io.IOException
Description copied from class: javax.net.SocketFactory
Creates a socket connected to a given host on a given port.


createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port,
                                    java.net.InetAddress localAddr,
                                    int localPort)
                             throws java.io.IOException,
                                    java.net.UnknownHostException
Description copied from class: javax.net.SocketFactory
Creates a socket connected to a given host on a given port, connecting locally to the interface with the given address and port.


createSocket

public java.net.Socket createSocket(java.net.InetAddress hostAddr,
                                    int port,
                                    java.net.InetAddress localAddr,
                                    int localPort)
                             throws java.io.IOException
Description copied from class: javax.net.SocketFactory
Creates a socket connected to a given host on a given port, connecting locally to the interface with the given address and port.


createSocket

protected java.net.Socket createSocket(java.net.InetAddress hostAddr,
                                       int port,
                                       java.net.InetAddress localAddr,
                                       int localPort,
                                       int connectTimeout)
                                throws java.io.IOException