@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); } } }
private void registerSubscriber0( @NotNull RequestContext rc, @NotNull Subscriber<MapEvent<K, V>> subscriber, @NotNull Filter<MapEvent<K, V>> filter) { addToStats("subscription"); final Subscriber<MapEvent<K, V>> sub = subscriber(subscriber, filter); this.subscribers.add(sub); Boolean bootstrap = rc.bootstrap(); if (bootstrap != Boolean.FALSE && kvStore != null) { try { for (int i = 0; i < kvStore.segments(); i++) kvStore.entriesFor(i, sub::onMessage); if (TRUE.equals(rc.endSubscriptionAfterBootstrap())) { sub.onEndOfSubscription(); LOG.info("onEndOfSubscription"); this.subscribers.remove(sub); } } catch (InvalidSubscriberException e) { this.subscribers.remove(sub); } } }