I have a use case in which I would like to run one 'application/service' at a time.
In a simple example lets say I have a bunch of Services. Each one can be added to a queue. Queue will run one service until completion and then run the next. If the queue is empty it just hangs around until something is put on. Basically I would like to enforce single 'threading', ie I do not want two of these services running at the same time.
To make things a little more complicated I would like to run this in an app server (i.e. JBoss AS).
I know in Java I could probably do something like use a blockingqueue and pull one service off at a time. But I don't think it is a good idea to implement your own threading solution in an app server.