|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.gleamynode.netty2.IoProcessor
public class IoProcessor
Performs I/O operations, interprets them into session events, and passes them
to EventDispatcher
.
IoProcessor
consists of two controller threads and other worker
threads:
SessionListener.sessionIdle(Session)
eventSession.write(Message)
requestEventDispatcher
.
IoProcessor
has properties such as:
threadPoolSize
: the number of worker
threadscontrollerThreadPriority
: the thread
priority of the controller threads. Default is Thread.NORM_PRIORITY
.
threadPriority
: the thread priority of
the worker threads. Default is Thread.NORM_PRIORITY
.readTries
: the max number of read
tries per OP_READ event; Some NIO implementations does not read all data at
once. Default is 2
.
To activate, call start()
method.
Constructor Summary | |
---|---|
IoProcessor()
Constructs a new instance with default properties. |
Method Summary | |
---|---|
int |
getControllerThreadPriority()
Returns the priority of controller threads. |
ExceptionMonitor |
getExceptionMonitor()
Returns the ExceptionMonitor . |
int |
getReadTries()
Deprecated. Netty2 now automatically retries a read operation until it returns 0. |
String |
getThreadNamePrefix()
Returns the prefix of the I/O thread name. |
int |
getThreadPoolSize()
Returns the number of worker threads. |
int |
getThreadPriority()
Returns the priority of worker threads. |
boolean |
isStarted()
Returns true only if this I/O processor is started. |
void |
setControllerThreadPriority(int newPriority)
Sets the priority of controller threads. |
void |
setExceptionMonitor(ExceptionMonitor monitor)
Sets the ExceptionMonitor . |
void |
setReadTries(int readTries)
Deprecated. Netty2 now automatically retries a read operation until it returns 0. |
void |
setThreadNamePrefix(String threadNamePrefix)
Sets the prefix of the I/O thread name. |
void |
setThreadPoolSize(int newSize)
Sets the number of worker threads. |
void |
setThreadPriority(int newPriority)
Sets the priority of worker threads. |
void |
start()
Starts all controllers and worker threads. |
void |
stop()
Stops all controllers and worker threads. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IoProcessor()
Method Detail |
---|
public void start() throws IOException
start
in interface IoProcessorMBean
IOException
- if failed to open a Selector
.public void stop()
stop
in interface IoProcessorMBean
public boolean isStarted()
true
only if this I/O processor is started.
isStarted
in interface IoProcessorMBean
public int getThreadPoolSize()
getThreadPoolSize
in interface IoProcessorMBean
public void setThreadPoolSize(int newSize)
setThreadPoolSize
in interface IoProcessorMBean
public int getControllerThreadPriority()
getControllerThreadPriority
in interface IoProcessorMBean
public void setControllerThreadPriority(int newPriority)
Thread.NORM_PRIORITY
.
setControllerThreadPriority
in interface IoProcessorMBean
IllegalArgumentException
- if the specified priority is not between
Thread.MIN_PRIORITY
and Thread.MAX_PRIORITY
.public int getThreadPriority()
getThreadPriority
in interface IoProcessorMBean
public void setThreadPriority(int newPriority)
Thread.NORM_PRIORITY
.
setThreadPriority
in interface IoProcessorMBean
IllegalArgumentException
- if the specified priority is not between
Thread.MIN_PRIORITY
and Thread.MAX_PRIORITY
.public int getReadTries()
SelectionKey.OP_READ
event.
getReadTries
in interface IoProcessorMBean
public void setReadTries(int readTries)
SelectionKey.OP_READ
event. This property is adjustable in runtime.
setReadTries
in interface IoProcessorMBean
IllegalArgumentException
- if the specified value is not greater than 0
.public String getThreadNamePrefix()
getThreadNamePrefix
in interface IoProcessorMBean
public void setThreadNamePrefix(String threadNamePrefix)
threadNamePrefix + '-' + threadId
.
setThreadNamePrefix
in interface IoProcessorMBean
public ExceptionMonitor getExceptionMonitor()
ExceptionMonitor
.
public void setExceptionMonitor(ExceptionMonitor monitor)
ExceptionMonitor
. Any uncaught exceptions will be
forwarded to the specified ExceptionMonitor
NullPointerException
- if monitor
is null
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |