Currently the logic for the Dispatcher can be simplified as follows:
while (msg =_queue.take() != null)
Stop if required
There are a couple of problems, the first is that if the _queue is not empty when the stop request is made then the dispatcher will remove a message from _queue and sit in the Stop until it is restarted, where it will then process the message.
The second issue is that if the queue is empty when the stop is requested then nothing happens... until a message is received and the dispatcher then removes it and holds it in the Stop.
Finally. there is no way to stop the dispatcher once it has made the take() call, other than via an interrupt() call.
Changes to the dispatcher should be done to allow it to be stopped and started with validation i.e. thread A calls dispatcher.stop() and that does not return until the dispatcher has stopped. Currently it is a request that is never confirmed.
In providing this functionality we will be able to avoid the interrupt() call that has already been identified as in need of addressing see
|Transition||Time In Source Status||Execution Times||Last Executer||Last Execution Date|
|707d 7h 26m||1||Robbie Gemmell||05/Sep/11 22:45|
|Status||Open [ 1 ]||Closed [ 6 ]|
|Resolution||Later [ 7 ]|
|Field||Original Value||New Value|
|Fix Version/s||JIRA Cleanup [ 12317862 ]|