We are working on an application where a set of objects can be affected by receiving messages from 3 different sources. Each message (from any of the sources) has a single objec
You should be able to provide a special BlockingQueue for ThreadPoolExecutor. The queue remembers which type of message is being processed by which thread, so that it can withhold all messages of the same type.
MyQueue
ownership relation of thread - msgType
take/poll()
if current thread owns msg type X
if there is a message of type X
return that message
else
give up ownership
// current thread does not own any message type
if there is a messsage of type Y, Y is not owned by any thread
current thread owns Y
return that message
// there's no message belonging to an unowned type
wait then retry