| java.lang.Object org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory
ControllerThreadSocketFactory | final public class ControllerThreadSocketFactory (Code) | | This helper class is intedned to help work around the limitation of older Java versions
(older than 1.4) that prevents from specifying a connection timeout when creating a
socket. This factory executes a controller thread overssing the process of socket
initialisation. If the socket constructor cannot be created within the specified time
limit, the controller terminates and throws an
ConnectTimeoutException
author: Ortwin Glueck author: Oleg Kalnichevski since: 3.0 |
Inner Class :abstract public static class SocketTask implements Runnable | |
createSocket | public static Socket createSocket(ProtocolSocketFactory socketfactory, String host, int port, InetAddress localAddress, int localPort, int timeout) throws IOException, UnknownHostException, ConnectTimeoutException(Code) | | This method spawns a controller thread overseeing the process of socket
initialisation. If the socket constructor cannot be created within the specified time
limit, the controller terminates and throws an
ConnectTimeoutException Parameters: host - the host name/IP Parameters: port - the port on the host Parameters: localAddress - the local host name/IP to bind the socket to Parameters: localPort - the port on the local machine Parameters: timeout - the timeout value to be used in milliseconds. If the socket cannot becompleted within the given time limit, it will be abandoned a connected Socket throws: IOException - if an I/O error occurs while creating the socket throws: UnknownHostException - if the IP address of the host cannot bedetermined throws: ConnectTimeoutException - if socket cannot be connected within thegiven time limit |
|
|