public abstract class ConnectionManager extends LoopingThread implements Lifecycle.ShutdownComponent
ConnectionManager doesn't directly accept TCP connections; it expects
ServerSocketChannelAcceptor or an external entity to do so and call its
handleAcceptedSocket(java.nio.channels.SocketChannel) method
Thread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
ConnectionManager(Lifecycle cycle,
long idleTime)
Creates a connection manager instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
closeConnection(Connection conn)
Queues a connection up to be closed on the conmgr thread.
|
ConMgrStats |
getStats()
Returns our current runtime statistics.
|
SelectionKey |
register(SelectableChannel chan,
int ops,
NetEventHandler netEventHandler)
Registers
ops on chan on this manager's selector and hooks
netEventHandler up to receive events whenever the selection occurs. |
void |
setShutdownAction(Runnable onExit)
Instructs us to execute the specified runnable when the connection manager thread exits.
|
void |
transferAcceptedSocket(SocketChannel channel)
Introduces a new active socket into Presents from off the ConnectionManager thread.
|
isRunning, run, shutdownactiveCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldequals, getClass, hashCode, notify, notifyAll, wait, wait, waitshutdownpublic ConnectionManager(Lifecycle cycle, long idleTime) throws IOException
IOExceptionpublic void setShutdownAction(Runnable onExit)
public ConMgrStats getStats()
public SelectionKey register(SelectableChannel chan, int ops, NetEventHandler netEventHandler) throws IOException
ops on chan on this manager's selector and hooks
netEventHandler up to receive events whenever the selection occurs.IOExceptionpublic void transferAcceptedSocket(SocketChannel channel)
public void closeConnection(Connection conn)
Copyright © 2015. All rights reserved.