Share via


KeepAliveSocketFactory Class

  • java.lang.Object
    • SSLSocketFactory
      • com.microsoft.azure.storage.core.KeepAliveSocketFactory

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 Details

createSocket

public Socket createSocket(InetAddress inetAddress, int i)

Parameters:

inetAddress
i

createSocket

public Socket createSocket(InetAddress inetAddress, int i, InetAddress inetAddress1, int i1)

Parameters:

inetAddress
i
inetAddress1
i1

createSocket

public Socket createSocket(Socket socket, String s, int i, boolean b)

Parameters:

socket
s
i
b

createSocket

public Socket createSocket(String s, int i)

Parameters:

s
i

createSocket

public Socket createSocket(String s, int i, InetAddress inetAddress, int i1)

Parameters:

s
i
inetAddress
i1

getDefaultCipherSuites

public String [] getDefaultCipherSuites()

getInstance

public static KeepAliveSocketFactory getInstance()

getSupportedCipherSuites

public String [] getSupportedCipherSuites()

Applies to