Affects Version/s: 5.5.1
Fix Version/s: AGING_TO_DIE
Component/s: JMS client
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) Server VM (build 20.5-b03, mixed mode)
OS: SunOs 10/06
Create a class with two synchronized methods synchMethod1 and synchMethod2.
syncMethod1 is invoked inside a messageListener object and only prints a message on stdout.
syncMethod2 creates a new MessageConsumer with a new instance of MessageListener. All the MessageConsumers created by synchMethod2 share the same session.
All the consumers listen on the same Topic named "myDest".
Create an infinite cycle that:
1) send a message on Topic "myDest"
2) invoke syncMethod2
3) waits 10ms
In attach the unit test source.
As result, a deadlock is created between the "ActiveMQ Session Task" thread entering in syncMethod1 having the ActiveMessageConsumer's mutex and my other thread executing the syncMethod2 when the SimplePriorityMessageDispatchChannel.stop() method is invoked.
This means that it's not possible to create or change MessageListeners on a running session, even if the code seems to handle this case stopping and restarting the session.