TMessage
- type of the message processed by the threadpublic class WorkingThread<TMessage>
extends java.lang.Object
Constructor and Description |
---|
WorkingThread() |
Modifier and Type | Method and Description |
---|---|
void |
enqueueMessage(TMessage message)
Puts the message to the queue.
|
void |
registerMessageHandler(IMethod1<TMessage> messageHandler)
Registers the method handling messages from the queue and starts the thread reading messages from the queue.
|
void |
unregisterMessageHandler()
Unregisters the method handling messages from the queue and stops the thread reading messages.
|
public void registerMessageHandler(IMethod1<TMessage> messageHandler)
messageHandler
- Callback called from the working thread to process the messagepublic void unregisterMessageHandler()
public void enqueueMessage(TMessage message) throws java.lang.Exception
message
- messagejava.lang.Exception