public class NioServer extends NioBaseServer
NioBaseServer.Acceptor
BaseServer.Reaper
Modifier and Type | Field and Description |
---|---|
protected java.nio.channels.ServerSocketChannel |
channel |
acceptor, copy_on_partial_write, max_send_buffers, num_selects, reader_idle_time, reg_lock, registration, selector
client_bind_addr, client_bind_port, conn_expire_time, conn_listeners, conns, defer_client_binding, factory, linger, local_addr, log, reaper, reaperInterval, receiver, recv_buf_size, running, send_buf_size, sock_conn_timeout, sock_creation_lock, tcp_nodelay, time_service, use_peer_connections
Modifier | Constructor and Description |
---|---|
|
NioServer(java.net.InetAddress bind_addr,
int port)
Creates an instance of
NioServer that opens a server channel and listens for connections. |
|
NioServer(IpAddress bind_addr)
Creates an instance of NioServer.
|
protected |
NioServer(ThreadFactory f) |
|
NioServer(ThreadFactory thread_factory,
java.net.InetAddress bind_addr,
int srv_port,
int end_port,
java.net.InetAddress external_addr,
int external_port)
Creates an instance of
NioServer that opens a server channel and listens for connections. |
Modifier and Type | Method and Description |
---|---|
protected void |
handleAccept(java.nio.channels.SelectionKey key) |
void |
start()
Starts accepting connections.
|
void |
stop()
Stops listening for connections and handling traffic.
|
acceptorRunning, copyOnPartialWrite, copyOnPartialWrite, createConnection, maxSendBuffers, maxSendBuffers, numPartialWrites, numSelects, printBuffers, readerIdleTime, readerIdleTime, register, selectorOpen
addConnection, addConnectionListener, clearConnections, clientBindAddress, clientBindAddress, clientBindPort, clientBindPort, close, closeConnection, connectionClosed, connectionEstablished, connectionEstablishedTo, connExpireTime, connExpireTimeout, deferClientBinding, deferClientBinding, explanation, getConnection, getNumConnections, getNumOpenConnections, hasConnection, linger, linger, localAddress, localAddress, log, log, notifyConnectionClosed, notifyConnectionEstablished, printConnections, reaperInterval, reaperInterval, receive, receive, receiveBufferSize, receiveBufferSize, receiver, receiver, removeConnectionIfPresent, removeConnectionListener, replaceConnection, retainAll, running, send, send, sendBufferSize, sendBufferSize, sendToAll, sendToAll, socketConnectionTimeout, socketConnectionTimeout, tcpNodelay, tcpNodelay, timeService, timeService, toString, usePeerConnections, usePeerConnections, validateArgs
public NioServer(IpAddress bind_addr) throws java.lang.Exception
bind_addr
- The local bind address and port. If null, a bind address and port will be picked by the OS.java.lang.Exception
public NioServer(java.net.InetAddress bind_addr, int port) throws java.lang.Exception
NioServer
that opens a server channel and listens for connections.
Needs to be started next.bind_addr
- The local address to bind to. If null, the address will be picked by the OSport
- The local port to bind tojava.lang.Exception
- Thrown if the creation failedpublic NioServer(ThreadFactory thread_factory, java.net.InetAddress bind_addr, int srv_port, int end_port, java.net.InetAddress external_addr, int external_port) throws java.lang.Exception
NioServer
that opens a server channel and listens for connections.
Needs to be started next.thread_factory
- The thread factory used to create new threadsbind_addr
- The local address to bind to. If null, the address will be picked by the OSsrv_port
- The local port to bind to If 0, the port will be picked by the OS.end_port
- If srv_port is taken, the next port is tried, until end_port has been reached, in which case an
exception will be thrown. If srv_port == end_port, only 1 port will be tried.external_addr
- The external address in case of NAT. Ignored if null.external_port
- The external port on the NA. If 0, srv_port is used.java.lang.Exception
- Thrown if the creation failedprotected NioServer(ThreadFactory f)
protected void handleAccept(java.nio.channels.SelectionKey key) throws java.lang.Exception
handleAccept
in class NioBaseServer
java.lang.Exception
public void start() throws java.lang.Exception
BaseServer
start
in class BaseServer
java.lang.Exception
public void stop()
BaseServer
stop
in class BaseServer
Copyright © 1998-2020 Red Hat. All Rights Reserved.