org.apache.jcs.auxiliary.lateral.socket.tcp.utils
Class SocketOpener

java.lang.Object
  extended by org.apache.jcs.auxiliary.lateral.socket.tcp.utils.SocketOpener
All Implemented Interfaces:
java.lang.Runnable

public class SocketOpener
extends java.lang.Object
implements java.lang.Runnable

This should no longer be needed.

Socket opener that will timeout on the initial connect rather than block forever. Technique from core java II.


Constructor Summary
SocketOpener(java.lang.String host, int port)
          Constructor for the SocketOpener object
 
Method Summary
 java.net.Socket getSocket()
           
static java.net.Socket openSocket(java.lang.String host, int port, int timeOut)
          Opens a socket with a connection timeout value.
 void run()
          Main processing method for the SocketOpener object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketOpener

public SocketOpener(java.lang.String host,
                    int port)
Constructor for the SocketOpener object

Parameters:
host -
port -
Method Detail

openSocket

public static java.net.Socket openSocket(java.lang.String host,
                                         int port,
                                         int timeOut)
Opens a socket with a connection timeout value. Joins against a background thread that does the opening.

Parameters:
host -
port -
timeOut -
Returns:
Socket

run

public void run()
Main processing method for the SocketOpener object

Specified by:
run in interface java.lang.Runnable

getSocket

public java.net.Socket getSocket()
Returns:
The opened socket


Copyright © 2002-2011 Apache Software Foundation. All Rights Reserved.