|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.gleamynode.netty2.AbstractThreadPooledEventDispatcher
A base class for thread-pooled event dispatchers.
Nested Class Summary | |
protected class |
AbstractThreadPooledEventDispatcher.AbstractWorker
|
Field Summary | |
protected List |
workers
|
Constructor Summary | |
protected |
AbstractThreadPooledEventDispatcher()
|
Method Summary | |
void |
flush()
(Optional operation) Flushes the buffered events. |
String |
getThreadNamePrefix()
Returns the prefix of dispatcher thread name. |
int |
getThreadPoolSize()
Returns the number of dispatcher threads. |
int |
getThreadPriority()
Returns the priority of dispatcher threads. |
boolean |
isStarted()
Returns true if this event dispatcher is started. |
protected abstract AbstractThreadPooledEventDispatcher.AbstractWorker |
newWorker()
|
protected abstract AbstractThreadPooledEventDispatcher.AbstractWorker |
removeWorker()
|
void |
setThreadNamePrefix(String threadNamePrefix)
Sets the prefix of dispatcher thread name. |
void |
setThreadPoolSize(int newSize)
Sets the number of dispatcher threads. |
void |
setThreadPriority(int newPriority)
Sets the priority of dispatcher threads. |
void |
start()
Starts this event dispatcher. |
void |
stop()
Stops this event dispatcher. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.gleamynode.netty2.EventDispatcher |
fire, getWaitingEventSize |
Field Detail |
protected final List workers
Constructor Detail |
protected AbstractThreadPooledEventDispatcher()
Method Detail |
public void start()
ThreadPooledEventDispatcher
start
in interface ThreadPooledEventDispatcher
public void stop()
ThreadPooledEventDispatcher
stop
in interface ThreadPooledEventDispatcher
public boolean isStarted()
ThreadPooledEventDispatcher
true
if this event dispatcher is started.
isStarted
in interface ThreadPooledEventDispatcher
public int getThreadPoolSize()
ThreadPooledEventDispatcher
getThreadPoolSize
in interface ThreadPooledEventDispatcher
public void setThreadPoolSize(int newSize)
ThreadPooledEventDispatcher
setThreadPoolSize
in interface ThreadPooledEventDispatcher
protected abstract AbstractThreadPooledEventDispatcher.AbstractWorker newWorker()
protected abstract AbstractThreadPooledEventDispatcher.AbstractWorker removeWorker()
public int getThreadPriority()
ThreadPooledEventDispatcher
getThreadPriority
in interface ThreadPooledEventDispatcher
public void setThreadPriority(int newPriority)
ThreadPooledEventDispatcher
setThreadPriority
in interface ThreadPooledEventDispatcher
public String getThreadNamePrefix()
ThreadPooledEventDispatcher
getThreadNamePrefix
in interface ThreadPooledEventDispatcher
public void setThreadNamePrefix(String threadNamePrefix)
ThreadPooledEventDispatcher
threadNamePrefix + '-' + threadId
.
setThreadNamePrefix
in interface ThreadPooledEventDispatcher
public void flush()
EventDispatcher
ReadController#processEvent(Event)
and
WriteController#processEvent(Event)
after the expected I/O
operations have been completed. So you can implement
EventDispatcher
to buffer the fireXXX
calls and
fire (flush) them here in actually.
flush
in interface EventDispatcher
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |