Package org.jgroups.blocks.cs
Class NioBaseServer
- java.lang.Object
-
- org.jgroups.blocks.cs.BaseServer
-
- org.jgroups.blocks.cs.NioBaseServer
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,ConnectionListener
public abstract class NioBaseServer extends BaseServer
- Since:
- 3.6.5
- Author:
- Bela Ban
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classNioBaseServer.Acceptor-
Nested classes/interfaces inherited from class org.jgroups.blocks.cs.BaseServer
BaseServer.Reaper
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Threadacceptorprotected booleancopy_on_partial_writeprotected intmax_send_buffersprotected intnum_selectsprotected longreader_idle_timeprotected java.util.concurrent.locks.Lockreg_lockprotected booleanregistrationprotected java.nio.channels.Selectorselector-
Fields inherited from class org.jgroups.blocks.cs.BaseServer
client_bind_addr, client_bind_port, conn_expire_time, conn_listeners, conns, defer_client_binding, factory, linger, local_addr, log, max_length, reaper, reaperInterval, receiver, recv_buf_size, running, send_buf_size, sock_conn_timeout, sock_creation_lock, socket_factory, tcp_nodelay, time_service, use_peer_connections
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNioBaseServer(ThreadFactory f, SocketFactory sf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidacceptorDone()booleanacceptorRunning()booleancopyOnPartialWrite()NioBaseServercopyOnPartialWrite(boolean b)protected NioConnectioncreateConnection(Address dest)Creates a new connection object to target dest, but doesn't yet connect itprotected voidhandleAccept(java.nio.channels.SelectionKey key)intmaxSendBuffers()NioBaseServermaxSendBuffers(int num)intnumPartialWrites()intnumSelects()java.lang.StringprintBuffers()Prints send and receive buffers for all connectionslongreaderIdleTime()NioBaseServerreaderIdleTime(long t)protected java.nio.channels.SelectionKeyregister(java.nio.channels.SelectableChannel ch, int interest_ops, NioConnection conn)booleanselectorOpen()-
Methods inherited from class org.jgroups.blocks.cs.BaseServer
addConnection, addConnectionListener, clearConnections, clientBindAddress, clientBindAddress, clientBindPort, clientBindPort, close, closeConnection, connectionClosed, connectionEstablished, connectionEstablishedTo, connExpireTime, connExpireTimeout, deferClientBinding, deferClientBinding, explanation, getConnection, getMaxLength, getNumConnections, getNumOpenConnections, hasConnection, linger, linger, localAddress, localAddress, log, log, notifyConnectionClosed, notifyConnectionEstablished, printConnections, reaperInterval, reaperInterval, receive, receive, receive, receiveBufferSize, receiveBufferSize, receiver, receiver, removeConnectionIfPresent, removeConnectionListener, replaceConnection, retainAll, running, send, send, sendBufferSize, sendBufferSize, sendToAll, sendToAll, setMaxLength, socketConnectionTimeout, socketConnectionTimeout, socketFactory, socketFactory, start, stop, tcpNodelay, tcpNodelay, timeService, timeService, toString, usePeerConnections, usePeerConnections, validateArgs
-
-
-
-
Field Detail
-
selector
protected java.nio.channels.Selector selector
-
acceptor
protected java.lang.Thread acceptor
-
reg_lock
protected final java.util.concurrent.locks.Lock reg_lock
-
registration
protected volatile boolean registration
-
max_send_buffers
protected int max_send_buffers
-
num_selects
protected int num_selects
-
copy_on_partial_write
protected boolean copy_on_partial_write
-
reader_idle_time
protected long reader_idle_time
-
-
Constructor Detail
-
NioBaseServer
protected NioBaseServer(ThreadFactory f, SocketFactory sf)
-
-
Method Detail
-
maxSendBuffers
public int maxSendBuffers()
-
maxSendBuffers
public NioBaseServer maxSendBuffers(int num)
-
selectorOpen
public boolean selectorOpen()
-
acceptorRunning
public boolean acceptorRunning()
-
numSelects
public int numSelects()
-
copyOnPartialWrite
public boolean copyOnPartialWrite()
-
readerIdleTime
public long readerIdleTime()
-
readerIdleTime
public NioBaseServer readerIdleTime(long t)
-
copyOnPartialWrite
public NioBaseServer copyOnPartialWrite(boolean b)
-
numPartialWrites
public int numPartialWrites()
-
printBuffers
public java.lang.String printBuffers()
Prints send and receive buffers for all connections
-
register
protected java.nio.channels.SelectionKey register(java.nio.channels.SelectableChannel ch, int interest_ops, NioConnection conn) throws java.lang.Exception- Throws:
java.lang.Exception
-
createConnection
protected NioConnection createConnection(Address dest) throws java.lang.Exception
Description copied from class:BaseServerCreates a new connection object to target dest, but doesn't yet connect it- Specified by:
createConnectionin classBaseServer- Throws:
java.lang.Exception
-
handleAccept
protected void handleAccept(java.nio.channels.SelectionKey key) throws java.lang.Exception- Throws:
java.lang.Exception
-
acceptorDone
protected void acceptorDone()
-
-