-
1. Re: MessageConsumer thread never goes away
timfox Jan 11, 2007 5:06 PM (in response to chipschoch)Please say what version of JBM, AS you are using and post your code.
-
2. Re: MessageConsumer thread never goes away
chipschoch Jan 11, 2007 6:03 PM (in response to chipschoch)I am not sure what JBM is but I am running jdk1.5.0_10, JBoss 4.0.5 GA, and Messaging 1.0.1GA. It would be difficult to post my actual code in this forum but it is essentially executing the following in the onMessage().
Properties p = new Properties ();
p.put (Context.PROVIDER_URL, "jnp://localhost:1099");
p.put (Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put (Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
InitialContext context = new InitialContext (p);
MessageConsumer consumer = null;
int count = 0;
Queue queue = (Queue) context.lookup (queuename);
try
{
consumer = jmssession.createConsumer (queue);
... do something here
]
consumer.close();
}
catch (Exception e)
{
System.err.println( "Exception while trying to clear error queue");
}
I verified that the createConsumer line is where the thread is being created and the thread remains when I undeploy my service. Each time a message goes through a new thread is created that never goes away.
Thanks -
3. Re: MessageConsumer thread never goes away
timfox Jan 11, 2007 6:20 PM (in response to chipschoch)JBM is JBoss Messaging.
Are your jms client and jms server running in the same VM?
Threads for server side consumers are taken from a server side "pool" which has a default max size of 200.
How many threads are you seeing?
If 200 is too high for you, you can reduce the number by adding an attribute QueuedExecutorPoolSize on the serverpeer specifying the max size you want. -
4. Re: MessageConsumer thread never goes away
chipschoch Jan 12, 2007 9:41 AM (in response to chipschoch)Yes, my mbean that is servicing my jms queues is running in the same jvm as the messaging service, that is, the mbean is deployed in the same default server that is running messaging.
So if I understand you correctly, the thread count will continue to grow until it reaches 200 then it will begin to reuse the consumer threads?
Forgive my ignorance but I am new to JBoss. To make it absolutely clear for me, and any other noobs interested, are you saying that in order to change this (for example to 50) I would add:
50
to messaging-service.xml under the ServerBean mbean?
Thanks for your rapid response. -
5. Re: MessageConsumer thread never goes away
timfox Jan 12, 2007 10:24 AM (in response to chipschoch)Yes, add an attribute:
<attribute name="QueuedExecutorPoolSize">50</attribute>
in the server peer mbean config