activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Millies, Sebastian" <>
Subject How to control thread creation in an embedded broker
Date Wed, 05 Oct 2011 11:16:55 GMT
Hello there,

I'm using an embedded BrokerService with a single destination,
which is a queue that hands off incoming messages to an SCA
logging service.

Internally, that logging service follows the producer-consumer pattern
with a single blocking queue, so the producer basically gets handed a
message from the broker and puts a log request on the queue.

The problem: as soon as the producer blocks, the broker starts
creating thousands of threads, most of which will also block.
until it runs out of memory. (I have already reduced the stack
available to each thread with the -Xss option.)

How can I control thread creation in the broker (perhaps by supplying
my own ThreadPoolExecutor with an upper bound on the maximum pool size)?

Here's how I create the broker. As you can see, I have already set
the property "dedicatedTaskRunner" to false.

jmsBroker = new BrokerService();
jmsBroker.setUseJmx( true );
jmsBroker.setPersistent( false );
// only relevant when using persistence
jmsBroker.setDeleteAllMessagesOnStartup( true );
jmsBroker.addConnector( "tcp://logginghost:61619" );
jmsBroker.setDedicatedTaskRunner( false );

-- Sebastian
IDS Scheer Consulting GmbH
Geschäftsführer/Managing Directors: Kamyar Niroumand, Ivo Totev
Sitz/Registered office: Altenkesseler Straße 17, 66115 Saarbrücken, Germany - Registergericht/Commercial
register: Saarbrücken HRB 19681

View raw message