Queue sub = binding.getQueue();  if (sub.numberOfReceivers() != 0) { throw new IllegalStateException("Cannot unsubscribe durable subscription " + subscriptionName + " since it has active subscribers"); }
   public void unsubscribe(String subscriptionName) throws JMSException   {      try      {         if (closed)         {            throw new IllegalStateException("Session is closed");         }         if (subscriptionName == null)         {            throw new InvalidDestinationException("Destination is null");         }            String clientID = connectionEndpoint.getClientID();            if (clientID == null)         {            throw new JMSException("null clientID on connection");         }                  String queueName = MessageQueueNameHelper.createSubscriptionName(clientID, subscriptionName);                  Binding binding = topicPostOffice.getBindingForQueueName(queueName);                  if (binding == null)         {            throw new InvalidDestinationException("Cannot find durable subscription with name " +                                                  subscriptionName + " to unsubscribe");         }                  //Unbind it           topicPostOffice.unbindQueue(queueName);      }      catch (Throwable t)      {         throw ExceptionUtil.handleJMSInvocation(t, this + " unsubscribe");      }   }