Messages need to be delivered to the message listeners of a session in a serial order.
Currently we are implementing this by the session maintaining a EDU.oswego.cs.dl.util.QueuedExecutor which queues up deliveries for listeners in the session.
The QueuedExecutor maintains it's own thread which excecutes Runnables from the queue, one by one.
I would like to avoid maintaining a thread per session, and be able to execute the Runnables using a global pool, but still maintaining serial order on a per session basis.
This could be done by maintaining a queue per session, but actually executing the Runnables on a thread from this global pool.
I'd like to avoid writing this class myself, but I can't see how I can use the Doug Lea concurrent classes to do this.
Any ideas?