Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ix.util
Class IPC.BufferedMessageListener

    java.lang.Object
      ix.util.IPC.BufferedMessageListener

All Implemented Interfaces:
  IPC.MessageListener

Enclosing class:
  IPC

    public static class IPC.BufferedMessageListener

extends java.lang.Object
implements IPC.MessageListener

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. /\/: ...

See Also:
  `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

### innerListener

    protected IPC.MessageListener innerListener

### thread

    protected TransferThread thread

Constructor Detail

### IPC.BufferedMessageListener

    public IPC.BufferedMessageListener(IPC.MessageListener innerListener)

  Constructs an (outer) listener and starts the thread that will pass messages to the inner listener.

### IPC.BufferedMessageListener

    protected IPC.BufferedMessageListener()

  Constructs a listener without an inner listener. This should be used only for subclasses that redefine the `handleMessage(IPC.InputMessage)` method.

Method Detail

### messageReceived

    public 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.

  Specified by:
    `messageReceived` in interface `IPC.MessageListener`

### handleMessage

    protected void handleMessage(IPC.InputMessage message)

  Called in this BufferedMessageListener's thread to process the the next message from the queue. The version of the method in this class does that by calling the inner listener's messageReceived method, and so it must be refefined in subclasses that do not have an inner listener.

  See Also:
    `IPC.MessageListener.messageReceived(IPC.InputMessage)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD