I have a JMS Listener, inside the listener I'm using an ExecutorService to run a worker on a fixed number of threads. like so:
public void onMessage(Message m) {
executor.execute(new Worker(m));
}
This executor has 10 threads, if I get 100 messages in at the same time and it takes a few seconds for each of these workers to run, am I going to have 90 JBoss JMS threads waiting on the 10 active Worker? So do each of these incoming messages get their own thread and eat up my resources while waiting?
Am I doing it completely wrong, is there a better way?
I'm using JBoss EAP and HornetQ