Package com.martiansoftware.nailgun
Class NGUnixDomainServerSocket
- java.lang.Object
-
- java.net.ServerSocket
-
- com.martiansoftware.nailgun.NGUnixDomainServerSocket
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class NGUnixDomainServerSocket extends java.net.ServerSocket
Implements aServerSocket
which binds to a local Unix domain socket and returns instances ofNGUnixDomainSocket
fromaccept()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NGUnixDomainServerSocket.NGUnixDomainServerSocketAddress
-
Field Summary
Fields Modifier and Type Field Description private int
backlog
private static int
DEFAULT_BACKLOG
private java.util.concurrent.atomic.AtomicInteger
fd
private boolean
isBound
private boolean
isClosed
-
Constructor Summary
Constructors Constructor Description NGUnixDomainServerSocket()
Constructs an unbound Unix domain server socket.NGUnixDomainServerSocket(int backlog)
Constructs an unbound Unix domain server socket with the specified listen backlog.NGUnixDomainServerSocket(int backlog, java.lang.String path)
Constructs and binds a Unix domain server socket to the specified path with the specified listen backlog.NGUnixDomainServerSocket(java.lang.String path)
Constructs and binds a Unix domain server socket to the specified path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.Socket
accept()
void
bind(java.net.SocketAddress endpoint)
void
close()
-
Methods inherited from class java.net.ServerSocket
bind, getChannel, getInetAddress, getLocalPort, getLocalSocketAddress, getReceiveBufferSize, getReuseAddress, getSoTimeout, implAccept, isBound, isClosed, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSocketFactory, setSoTimeout, toString
-
-
-
-
Field Detail
-
DEFAULT_BACKLOG
private static final int DEFAULT_BACKLOG
- See Also:
- Constant Field Values
-
fd
private final java.util.concurrent.atomic.AtomicInteger fd
-
backlog
private final int backlog
-
isBound
private boolean isBound
-
isClosed
private boolean isClosed
-
-
Constructor Detail
-
NGUnixDomainServerSocket
public NGUnixDomainServerSocket() throws java.io.IOException
Constructs an unbound Unix domain server socket.- Throws:
java.io.IOException
-
NGUnixDomainServerSocket
public NGUnixDomainServerSocket(int backlog) throws java.io.IOException
Constructs an unbound Unix domain server socket with the specified listen backlog.- Throws:
java.io.IOException
-
NGUnixDomainServerSocket
public NGUnixDomainServerSocket(java.lang.String path) throws java.io.IOException
Constructs and binds a Unix domain server socket to the specified path.- Throws:
java.io.IOException
-
NGUnixDomainServerSocket
public NGUnixDomainServerSocket(int backlog, java.lang.String path) throws java.io.IOException
Constructs and binds a Unix domain server socket to the specified path with the specified listen backlog.- Throws:
java.io.IOException
-
-
Method Detail
-
bind
public void bind(java.net.SocketAddress endpoint) throws java.io.IOException
- Overrides:
bind
in classjava.net.ServerSocket
- Throws:
java.io.IOException
-
accept
public java.net.Socket accept() throws java.io.IOException
- Overrides:
accept
in classjava.net.ServerSocket
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.net.ServerSocket
- Throws:
java.io.IOException
-
-