Package one.nio.server
Class Server
java.lang.Object
one.nio.server.Server
- All Implemented Interfaces:
ServerMXBean
- Direct Known Subclasses:
HttpServer,RpcServer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected one.nio.server.AcceptorThread[]protected final CleanupThreadprotected booleanprotected final intprotected SelectorThread[]protected final CountDownLatchprotected booleanprotected final one.nio.server.WorkerPool -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidasyncExecute(Runnable command) protected SessioncreateSession(Socket socket) longintlonglongdoublelonglonglonglonglongdoubleintintlonglongintintbooleanfinal voidfinal voidvoidreconfigure(ServerConfig config) protected voidvoidvoidreset()voidstart()voidstop()
-
Field Details
-
port
protected final int port -
startSync
-
acceptors
protected volatile one.nio.server.AcceptorThread[] acceptors -
selectors
-
useWorkers
protected boolean useWorkers -
workers
protected final one.nio.server.WorkerPool workers -
cleanup
-
closeSessions
protected boolean closeSessions
-
-
Constructor Details
-
Server
- Throws:
IOException
-
-
Method Details
-
reconfigure
- Throws:
IOException
-
start
public void start() -
stop
public void stop() -
registerShutdownHook
public void registerShutdownHook() -
createSession
- Throws:
RejectedSessionException
-
register
-
incRequestsProcessed
public final void incRequestsProcessed() -
incRequestsRejected
public final void incRequestsRejected() -
getConnections
public int getConnections()- Specified by:
getConnectionsin interfaceServerMXBean
-
getKeepAlive
public long getKeepAlive()- Specified by:
getKeepAlivein interfaceServerMXBean
-
getWorkersUsed
public boolean getWorkersUsed()- Specified by:
getWorkersUsedin interfaceServerMXBean
-
getWorkers
public int getWorkers()- Specified by:
getWorkersin interfaceServerMXBean
-
getWorkersActive
public int getWorkersActive()- Specified by:
getWorkersActivein interfaceServerMXBean
-
getAcceptedSessions
public long getAcceptedSessions()- Specified by:
getAcceptedSessionsin interfaceServerMXBean
-
getRejectedSessions
public long getRejectedSessions()- Specified by:
getRejectedSessionsin interfaceServerMXBean
-
getSelectorCount
public int getSelectorCount()- Specified by:
getSelectorCountin interfaceServerMXBean
-
getSelectorAvgReady
public double getSelectorAvgReady()- Specified by:
getSelectorAvgReadyin interfaceServerMXBean
-
getSelectorMaxReady
public int getSelectorMaxReady()- Specified by:
getSelectorMaxReadyin interfaceServerMXBean
-
getSelectorOperations
public long getSelectorOperations()- Specified by:
getSelectorOperationsin interfaceServerMXBean
-
getSelectorSessions
public long getSelectorSessions()- Specified by:
getSelectorSessionsin interfaceServerMXBean
-
getQueueAvgLength
public double getQueueAvgLength()- Specified by:
getQueueAvgLengthin interfaceServerMXBean
-
getQueueAvgBytes
public long getQueueAvgBytes()- Specified by:
getQueueAvgBytesin interfaceServerMXBean
-
getQueueMaxLength
public long getQueueMaxLength()- Specified by:
getQueueMaxLengthin interfaceServerMXBean
-
getQueueMaxBytes
public long getQueueMaxBytes()- Specified by:
getQueueMaxBytesin interfaceServerMXBean
-
getRequestsProcessed
public long getRequestsProcessed()- Specified by:
getRequestsProcessedin interfaceServerMXBean
-
getRequestsRejected
public long getRequestsRejected()- Specified by:
getRequestsRejectedin interfaceServerMXBean
-
reset
public void reset()- Specified by:
resetin interfaceServerMXBean
-
asyncExecute
-