Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
static int |
ACCEPT_TIMOUT_MS |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
SelectThread() |
Modifier and Type | Method and Description |
---|---|
void |
closeChannels(SelectHandler handler)
Close all channels associated with this handler
|
LinkedList<SelectableChannel> |
getChannels(SelectHandler handler)
Find all channels associated with this handler
|
void |
run() |
int |
startServer(int port,
SelectHandler handler)
Start listening for connections on the given port.
|
int |
startServer(SelectHandler handler)
Start listening on a system-selected port.
|
void |
terminate() |
void |
unregisterChannel(SelectableChannel channel)
Stop selecting on this channel.
|
activeCount, checkAccess, clone, 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, yield
public SelectThread() throws IOException
IOException
public void closeChannels(SelectHandler handler)
handler
- the handlerpublic LinkedList<SelectableChannel> getChannels(SelectHandler handler)
handler
- the handlerpublic int startServer(int port, SelectHandler handler) throws IOException
port
- to bind server socket tohandler
- to receive selection event callbacksIOException
- if an error occurspublic int startServer(SelectHandler handler) throws IOException
handler
- the handlerIOException
- if an error occurspublic void terminate()
public void unregisterChannel(SelectableChannel channel)
channel
- the channelCopyright © 2015 Aspera Inc.. All rights reserved.