Class UnixDomainSocketFactory
- java.lang.Object
-
- org.apache.hc.client5.http.socket.UnixDomainSocketFactory
-
@Contract(threading=STATELESS) @Internal public final class UnixDomainSocketFactory extends java.lang.ObjectA factory for Unix domain sockets.This implementation supports both the JDK16+ standard library implementation (JEP 380) and the JUnixSocket library. It will automatically detect which implementation is available and use it; if both are available, the standard library implementation is preferred.
- Since:
- 5.6
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classUnixDomainSocketFactory.Implementation
-
Field Summary
Fields Modifier and Type Field Description private static UnixDomainSocketFactory.ImplementationIMPLEMENTATIONprivate static UnixDomainSocketFactoryINSTANCEDefault instance ofUnixDomainSocketFactory.private static java.lang.StringJDK_UNIX_SOCKET_ADDRESS_CLASSprivate static java.lang.StringJUNIXSOCKET_ADDRESS_CLASSprivate static java.lang.StringJUNIXSOCKET_SOCKET_CLASSprivate static org.slf4j.LoggerLOG
-
Constructor Summary
Constructors Constructor Description UnixDomainSocketFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.SocketconnectSocket(java.net.Socket socket, java.nio.file.Path socketPath, org.apache.hc.core5.util.TimeValue connectTimeout)java.net.SocketcreateSocket()java.net.SocketAddresscreateSocketAddress(java.nio.file.Path socketPath)private static UnixDomainSocketFactory.ImplementationdetectImplementation()static UnixDomainSocketFactorygetSocketFactory()Gets the singleton instance ofUnixDomainSocketFactory.static booleanisAvailable()Checks if Unix Domain Socket support is available.
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
JDK_UNIX_SOCKET_ADDRESS_CLASS
private static final java.lang.String JDK_UNIX_SOCKET_ADDRESS_CLASS
- See Also:
- Constant Field Values
-
JUNIXSOCKET_SOCKET_CLASS
private static final java.lang.String JUNIXSOCKET_SOCKET_CLASS
- See Also:
- Constant Field Values
-
JUNIXSOCKET_ADDRESS_CLASS
private static final java.lang.String JUNIXSOCKET_ADDRESS_CLASS
- See Also:
- Constant Field Values
-
IMPLEMENTATION
private static final UnixDomainSocketFactory.Implementation IMPLEMENTATION
-
INSTANCE
private static final UnixDomainSocketFactory INSTANCE
Default instance ofUnixDomainSocketFactory.
-
-
Method Detail
-
detectImplementation
private static UnixDomainSocketFactory.Implementation detectImplementation()
-
isAvailable
public static boolean isAvailable()
Checks if Unix Domain Socket support is available.- Returns:
- true if Unix Domain Socket support is available, false otherwise
-
getSocketFactory
public static UnixDomainSocketFactory getSocketFactory()
Gets the singleton instance ofUnixDomainSocketFactory.- Returns:
- the singleton instance
-
createSocketAddress
public java.net.SocketAddress createSocketAddress(java.nio.file.Path socketPath)
-
createSocket
public java.net.Socket createSocket() throws java.io.IOException- Throws:
java.io.IOException
-
connectSocket
public java.net.Socket connectSocket(java.net.Socket socket, java.nio.file.Path socketPath, org.apache.hc.core5.util.TimeValue connectTimeout) throws java.io.IOException- Throws:
java.io.IOException
-
-