Details
-
Bug
-
Resolution: Done
-
Major
-
JBossAS-4.0.3 SP1, JBossAS-4.0.4.GA, JBossAS-4.0.5.GA
-
None
Description
According to the spec, it is an application error to unsubscribe a Durable Topic Subscription
when there is an active subscriber or there are unacknowledged messages/uncommitted
transactions for the subscription.
We don't currently check for this condition, except that it can lead to an NPE
if somebody does it which will then might also leave the state manager in an inconsistent state
(it can only be fixed by rebooting).
Since this is an application error, the application should receive an error
(javax.jms.IllegalStateException) if it is tried.
It should not lead to corrupted server state.
The code already exists for this (related to disallowing the deletion of temporary queues with
active subscribers) so it is just a case of:
1) Updating the "inUse" check in BasicQueue to also look for unacknowledged messages
(this also covers uncommitted transactions). This check also applies to temporary queues/topics.
2) Adding the code to check "inUse" in JMSTopic.destroyDurableSubscription()
before doing the removeAllMessages().