java.io.Closeable, java.lang.AutoCloseable@LimitedPrivate("HDFS")
public class DomainSocket
extends java.lang.Object
implements java.io.Closeable
DomainSocket for more information about UNIX domain sockets.| Modifier and Type | Class | Description |
|---|---|---|
class |
DomainSocket.DomainChannel |
|
class |
DomainSocket.DomainInputStream |
Input stream for UNIX domain sockets.
|
class |
DomainSocket.DomainOutputStream |
Output stream for UNIX domain sockets.
|
| Modifier and Type | Field | Description |
|---|---|---|
static int |
RECEIVE_BUFFER_SIZE |
|
static int |
RECEIVE_TIMEOUT |
|
static int |
SEND_BUFFER_SIZE |
|
static int |
SEND_TIMEOUT |
| Modifier and Type | Method | Description |
|---|---|---|
DomainSocket |
accept() |
Accept a new UNIX domain connection.
|
static DomainSocket |
bindAndListen(java.lang.String path) |
Create a new DomainSocket listening on the given path.
|
void |
close() |
Close the Socket.
|
static DomainSocket |
connect(java.lang.String path) |
Create a new DomainSocket connected to the given path.
|
static void |
disableBindPathValidation() |
Disable validation of the server bind paths.
|
int |
getAttribute(int type) |
|
DomainSocket.DomainChannel |
getChannel() |
|
static java.lang.String |
getEffectivePath(java.lang.String path,
int port) |
Given a path and a port, compute the effective path by replacing
occurrences of _PORT with the port.
|
DomainSocket.DomainInputStream |
getInputStream() |
|
static java.lang.String |
getLoadingFailureReason() |
Return true only if UNIX domain sockets are available.
|
DomainSocket.DomainOutputStream |
getOutputStream() |
|
java.lang.String |
getPath() |
|
boolean |
isOpen() |
Return true if the file descriptor is currently open.
|
int |
recvFileInputStreams(java.io.FileInputStream[] streams,
byte[] buf,
int offset,
int length) |
Receive some FileDescriptor objects from the process on the other side of
this socket, and wrap them in FileInputStream objects.
|
void |
sendFileDescriptors(java.io.FileDescriptor[] descriptors,
byte[] jbuf,
int offset,
int length) |
Send some FileDescriptor objects to the process on the other side of this
socket.
|
void |
setAttribute(int type,
int size) |
|
void |
shutdown() |
Call shutdown(SHUT_RDWR) on the UNIX domain socket.
|
static DomainSocket[] |
socketpair() |
Create a pair of UNIX domain sockets which are connected to each other
by calling socketpair(2).
|
java.lang.String |
toString() |
public static final int SEND_BUFFER_SIZE
public static final int RECEIVE_BUFFER_SIZE
public static final int SEND_TIMEOUT
public static final int RECEIVE_TIMEOUT
public static java.lang.String getLoadingFailureReason()
@VisibleForTesting public static void disableBindPathValidation()
public static java.lang.String getEffectivePath(java.lang.String path,
int port)
path - The source pathport - Port number to usepublic static DomainSocket bindAndListen(java.lang.String path) throws java.io.IOException
path - The path to bind and listen on.java.io.IOException - raised on errors performing I/O.public static DomainSocket[] socketpair() throws java.io.IOException
java.io.IOException - on error.public DomainSocket accept() throws java.io.IOException
java.io.IOException - If there was an I/O error performing the accept--
such as the socket being closed from under us.
Particularly when the accept is timed out, it throws
SocketTimeoutException.public static DomainSocket connect(java.lang.String path) throws java.io.IOException
path - The path to connect to.java.io.IOException - If there was an I/O error performing the connect.public boolean isOpen()
public java.lang.String getPath()
public DomainSocket.DomainInputStream getInputStream()
public DomainSocket.DomainOutputStream getOutputStream()
public DomainSocket.DomainChannel getChannel()
public void setAttribute(int type,
int size)
throws java.io.IOException
java.io.IOExceptionpublic int getAttribute(int type)
throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablejava.io.IOExceptionpublic void shutdown()
throws java.io.IOException
java.io.IOException - raised on errors performing I/O.public void sendFileDescriptors(java.io.FileDescriptor[] descriptors,
byte[] jbuf,
int offset,
int length)
throws java.io.IOException
descriptors - The file descriptors to send.jbuf - Some bytes to send. You must send at least
one byte.offset - The offset in the jbuf array to start at.length - Length of the jbuf array to use.java.io.IOException - raised on errors performing I/O.public int recvFileInputStreams(java.io.FileInputStream[] streams,
byte[] buf,
int offset,
int length)
throws java.io.IOException
streams - input stream.buf - input buf.offset - input offset.length - input length.java.io.IOException - raised on errors performing I/O.public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2008–2025 Apache Software Foundation. All rights reserved.