コード例 #1
0
 @Override
 public void unregisterSubscriber(@NotNull Subscriber subscriber) {
   final Subscriber delegate = subscriptionDelegate.get(subscriber);
   final Subscriber s = delegate != null ? delegate : subscriber;
   boolean subscription = subscribers.remove(s);
   boolean keySubscription = keySubscribers.remove(s);
   if (subscription) removeFromStats("subscription");
   if (keySubscription) removeFromStats("keySubscription");
   s.onEndOfSubscription();
 }
コード例 #2
0
 @Override
 public void registerKeySubscriber(
     @NotNull RequestContext rc, @NotNull Subscriber<K> subscriber, @NotNull Filter<K> filter) {
   addToStats("keySubscription");
   final Boolean bootstrap = rc.bootstrap();
   final Subscriber<K> sub = subscriber(subscriber, filter);
   keySubscribers.add(sub);
   if (bootstrap != Boolean.FALSE && kvStore != null) {
     try {
       for (int i = 0; i < kvStore.segments(); i++) kvStore.keysFor(i, sub::onMessage);
       if (TRUE.equals(rc.endSubscriptionAfterBootstrap())) {
         sub.onEndOfSubscription();
         keySubscribers.remove(sub);
       }
     } catch (InvalidSubscriberException e) {
       keySubscribers.remove(sub);
     }
   }
 }