|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ix.util.IPC.BufferedMessageListener
public static class IPC.BufferedMessageListener
A MessageListener that enqueues messages for processing in a separate thread of the listener's own.
There are two ways to use this class. An instance of this class
can be used as a wrapper around an existing "inner" MessageListener.
Or an instance of a subclass can be used without an inner listener
if the subclass redefines the handleMessage(IPC.InputMessage)
method.
Note that in this class the messageReceived method only enqueues a message for later processing, and that it's the handleMessage method that actually processes the message, after its been removed from the queue by the BufferedMessageListener's thread.
Here's why the class is useful. Suppose an ordinary MessageListener is invoked in a thread T by calling its messageReceived method. T cannot do anything else until that call returns. /\/: ...
MessageQueue
,
TransferThread
Field Summary | |
---|---|
protected IPC.MessageListener |
innerListener
|
protected TransferThread |
thread
|
Constructor Summary | |
---|---|
protected |
IPC.BufferedMessageListener()
Constructs a listener without an inner listener. |
|
IPC.BufferedMessageListener(IPC.MessageListener innerListener)
Constructs an (outer) listener and starts the thread that will pass messages to the inner listener. |
Method Summary | |
---|---|
protected void |
handleMessage(IPC.InputMessage message)
Called in this BufferedMessageListener's thread to process the the next message from the queue. |
void |
messageReceived(IPC.InputMessage message)
Enqueues a message for later processing by the handleMessage(IPC.InputMessage) method, which
will be called in this BufferedMessageListener's thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected IPC.MessageListener innerListener
protected TransferThread thread
Constructor Detail |
---|
public IPC.BufferedMessageListener(IPC.MessageListener innerListener)
protected IPC.BufferedMessageListener()
handleMessage(IPC.InputMessage)
method.
Method Detail |
---|
public void messageReceived(IPC.InputMessage message)
handleMessage(IPC.InputMessage)
method, which
will be called in this BufferedMessageListener's thread.
messageReceived
in interface IPC.MessageListener
protected void handleMessage(IPC.InputMessage message)
IPC.MessageListener.messageReceived(IPC.InputMessage)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |