Class ControllerThreadSocketFactory
- java.lang.Object
-
- org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory
-
@Deprecated public final class ControllerThreadSocketFactory extends java.lang.Object
Deprecated.Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project. It is not recommended to use it in any new code. Instead, use HTTP client API plugins as a dependency in your code. E.g. Apache HttpComponents Client API 4.x Plugin or Async HTTP Client Plugin.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 anConnectTimeoutException
- Since:
- 3.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ControllerThreadSocketFactory.SocketTask
Deprecated.Helper class for wrapping socket based tasks.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.net.Socket
createSocket(ControllerThreadSocketFactory.SocketTask task, int timeout)
Deprecated.static java.net.Socket
createSocket(ProtocolSocketFactory socketfactory, java.lang.String host, int port, java.net.InetAddress localAddress, int localPort, int timeout)
Deprecated.This method spawns a controller thread overseeing the process of socket initialisation.
-
-
-
Method Detail
-
createSocket
public static java.net.Socket createSocket(ProtocolSocketFactory socketfactory, java.lang.String host, int port, java.net.InetAddress localAddress, int localPort, int timeout) throws java.io.IOException, java.net.UnknownHostException, ConnectTimeoutException
Deprecated.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 anConnectTimeoutException
- Parameters:
host
- the host name/IPport
- the port on the hostlocalAddress
- the local host name/IP to bind the socket tolocalPort
- the port on the local machinetimeout
- the timeout value to be used in milliseconds. If the socket cannot be completed within the given time limit, it will be abandoned- Returns:
- a connected Socket
- Throws:
java.io.IOException
- if an I/O error occurs while creating the socketjava.net.UnknownHostException
- if the IP address of the host cannot be determinedConnectTimeoutException
- if socket cannot be connected within the given time limit
-
createSocket
public static java.net.Socket createSocket(ControllerThreadSocketFactory.SocketTask task, int timeout) throws java.io.IOException, java.net.UnknownHostException, ConnectTimeoutException
Deprecated.- Throws:
java.io.IOException
java.net.UnknownHostException
ConnectTimeoutException
-
-