public class NioServer extends BaseServer<Address,NioConnection>
Modifier and Type | Class and Description |
---|---|
protected class |
NioServer.Acceptor |
BaseServer.ConnectionListener<A,V extends Connection>, BaseServer.Reaper
Modifier and Type | Field and Description |
---|---|
protected java.lang.Thread |
acceptor |
protected java.nio.channels.ServerSocketChannel |
channel |
protected int |
max_read_batch_size |
protected int |
max_send_buffers |
protected java.util.concurrent.locks.Lock |
reg_lock |
protected boolean |
registration |
protected java.nio.channels.Selector |
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, socket_factory, tcp_nodelay, time_service
Constructor and Description |
---|
NioServer(java.net.InetAddress bind_addr,
int port) |
NioServer(IpAddress local_addr) |
NioServer(ThreadFactory f,
SocketFactory socket_factory,
Receiver<Address> r,
java.net.InetAddress bind_addr,
java.net.InetAddress external_addr,
int external_port,
int srv_port,
int end_port,
long reaper_interval,
long conn_expire_time) |
Modifier and Type | Method and Description |
---|---|
protected NioConnection |
createConnection(Address dest)
Creates a new connection object to target dest, but doesn't yet connect it
|
int |
maxReadBatchSize() |
NioServer |
maxReadBatchSize(int size) |
int |
maxSendBuffers() |
NioServer |
maxSendBuffers(int num) |
java.lang.String |
printBuffers()
Prints send and receive buffers for all connections
|
protected java.nio.channels.SelectionKey |
register(java.nio.channels.SelectableChannel ch,
int interest_ops,
NioConnection conn) |
void |
start()
Starts the server.
|
void |
stop()
Stops the server, e.g.
|
addConnection, addConnectionListener, clientBindAddress, clientBindAddress, clientBindPort, clientBindPort, close, connectionEstablishedTo, connExpireTime, connExpireTimeout, deferClientBinding, deferClientBinding, explanation, getConnection, getNumConnections, getNumOpenConnections, hasConnection, linger, linger, localAddress, log, log, notifyConnectionClosed, notifyConnectionOpened, printConnections, reaperInterval, reaperInterval, receive, receive, receiveBufferSize, receiveBufferSize, receiver, receiver, removeConnectionIfPresent, removeConnectionListener, replaceConnection, retainAll, send, send, sendBufferSize, sendBufferSize, socketConnectionTimeout, socketConnectionTimeout, socketFactory, socketFactory, tcpNodelay, tcpNodelay, timeService, timeService, toString, validateArgs
protected java.nio.channels.ServerSocketChannel channel
protected java.nio.channels.Selector selector
protected final java.lang.Thread acceptor
protected final java.util.concurrent.locks.Lock reg_lock
protected volatile boolean registration
protected int max_send_buffers
protected int max_read_batch_size
public NioServer(IpAddress local_addr) throws java.lang.Exception
java.lang.Exception
public NioServer(java.net.InetAddress bind_addr, int port) throws java.lang.Exception
java.lang.Exception
public NioServer(ThreadFactory f, SocketFactory socket_factory, Receiver<Address> r, java.net.InetAddress bind_addr, java.net.InetAddress external_addr, int external_port, int srv_port, int end_port, long reaper_interval, long conn_expire_time) throws java.lang.Exception
java.lang.Exception
public int maxSendBuffers()
public NioServer maxSendBuffers(int num)
public int maxReadBatchSize()
public NioServer maxReadBatchSize(int size)
public java.lang.String printBuffers()
public void start() throws java.lang.Exception
Server
start
in interface Server<Address>
start
in class BaseServer<Address,NioConnection>
java.lang.Exception
public void stop()
Server
stop
in interface Server<Address>
stop
in class BaseServer<Address,NioConnection>
protected NioConnection createConnection(Address dest) throws java.lang.Exception
BaseServer
createConnection
in class BaseServer<Address,NioConnection>
java.lang.Exception
protected java.nio.channels.SelectionKey register(java.nio.channels.SelectableChannel ch, int interest_ops, NioConnection conn) throws java.lang.Exception
java.lang.Exception
Copyright © 1998-2020 Red Hat. All Rights Reserved.