KeepAliveSocketFactory Class
- java.
lang. Object - SSLSocketFactory
- com.
microsoft. azure. storage. core. KeepAliveSocketFactory
- com.
public class KeepAliveSocketFactory
RESERVED FOR INTERNAL USE.
This type is used to help work around a bug in the JDK where connection timeouts are not honored on a retried request. In other words, if a customer set a timeout on an operation, this timeout is only ever respected on the first attempt at the request. Retries will cause a different underlying connection implementation to be loaded that will ignore the timeout parameter. Therefore, requests can potentially hang forever if the connection is broken after these retries.
Enabling keep-alive timeouts acts as a fallback in these scenarios so that, even if the operation timeout is ignored, the socket will still eventually timeout and the request will be cancelled. We enable keep alive timeouts via a wrapper implementation of a SocketFactory. We use a default socket factory to get sockets from the system and then simply set the keep-alive option to true before returning to the client. This factory will be set on the HttpsUrlConnection objects.
Method Summary
Modifier and Type | Method and Description |
---|---|
Socket | createSocket(InetAddress inetAddress, int i) |
Socket | createSocket(InetAddress inetAddress, int i, InetAddress inetAddress1, int i1) |
Socket | createSocket(Socket socket, String s, int i, boolean b) |
Socket | createSocket(String s, int i) |
Socket | createSocket(String s, int i, InetAddress inetAddress, int i1) |
String [] | getDefaultCipherSuites() |
Keep |
getInstance() |
String [] | getSupportedCipherSuites() |
Method Details
createSocket
public Socket createSocket(InetAddress inetAddress, int i)
Parameters:
createSocket
public Socket createSocket(InetAddress inetAddress, int i, InetAddress inetAddress1, int i1)
Parameters:
createSocket
public Socket createSocket(Socket socket, String s, int i, boolean b)
Parameters:
createSocket
public Socket createSocket(String s, int i)
Parameters:
createSocket
public Socket createSocket(String s, int i, InetAddress inetAddress, int i1)
Parameters:
getDefaultCipherSuites
public String [] getDefaultCipherSuites()
getInstance
public static KeepAliveSocketFactory getInstance()
getSupportedCipherSuites
public String [] getSupportedCipherSuites()