// Section 6.11. JMS 1.1.
// "It is erroneous for a client to delete a durable subscription while it has an active
// TopicSubscriber for it or while a message received by it is part of a current
// transaction or has not been acknowledged in the session."
Queue sub = binding.getQueue();
if (sub.getNumberOfReceivers() != 0)
{
throw new IllegalStateException("Cannot unsubscribe durable subscription " +
subscriptionName + " since it has active subscribers");
}
//Look up the topic
JMSCondition topicCond = (JMSCondition)binding.getCondition();
String topicName = topicCond.getName();
ManagedDestination mDest = dm.getDestination(topicName, false);
//Unbind it
if (mDest.isClustered() && !postOffice.isLocal())
{
ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
cpo.unbindClusteredQueue(queueName);
}
else
{
postOffice.unbindQueue(queueName);
}
String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + sub.getName();
MessageCounter counter = sp.getMessageCounterManager().unregisterMessageCounter(counterName);
if (counter == null)
{