Пример #1
0
  /** Stops the subscription manager. */
  @Override
  public void stop() {
    super.stop();

    // Remove management.
    if (isManaged() && getControl() != null) {
      getControl().unregister();
      setControl(null);
      setManaged(false);
    }

    // Destroy subscriptions
    synchronized (this) {
      if (subscriberSessionManager != null) {
        subscriberSessionManager.shutdown();
        subscriberSessionManager = null;
      }
    }

    synchronized (allSubscriptionsLock) {
      if (!allSubscriptions.isEmpty()) {
        for (Map.Entry<Object, MessageClient> objectMessageClientEntry :
            allSubscriptions.entrySet()) removeSubscriber(objectMessageClientEntry.getValue());
      }
    }
  }
Пример #2
0
 /**
  * Turn on timeout for the provided client.
  *
  * @param client the client
  */
 protected void monitorTimeout(MessageClient client) {
   if (subscriberSessionManager != null) {
     synchronized (client) {
       if (!client.isTimingOut()) {
         subscriberSessionManager.scheduleTimeout(client);
         client.setTimingOut(true);
       }
     }
   }
 }