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 class
NioBaseServer.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.Thread
acceptor
protected boolean
copy_on_partial_write
protected int
max_send_buffers
protected int
num_selects
protected long
reader_idle_time
protected java.util.concurrent.locks.Lock
reg_lock
protected boolean
registration
protected java.nio.channels.Selector
selector
-
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 protected
NioBaseServer(ThreadFactory f, SocketFactory sf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
acceptorDone()
boolean
acceptorRunning()
boolean
copyOnPartialWrite()
NioBaseServer
copyOnPartialWrite(boolean b)
protected NioConnection
createConnection(Address dest)
Creates a new connection object to target dest, but doesn't yet connect itprotected void
handleAccept(java.nio.channels.SelectionKey key)
int
maxSendBuffers()
NioBaseServer
maxSendBuffers(int num)
int
numPartialWrites()
int
numSelects()
java.lang.String
printBuffers()
Prints send and receive buffers for all connectionslong
readerIdleTime()
NioBaseServer
readerIdleTime(long t)
protected java.nio.channels.SelectionKey
register(java.nio.channels.SelectableChannel ch, int interest_ops, NioConnection conn)
boolean
selectorOpen()
-
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:BaseServer
Creates a new connection object to target dest, but doesn't yet connect it- Specified by:
createConnection
in 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()
-
-