@Override public Observable<Void> change(Interest<InstanceInfo> newInterest) { logger.debug("Received interest change request {}", newInterest); if (STATES.Closed == state.get()) { /** * Since channel is already closed and hence the transport, we don't need to send an error on transport. */ return Observable.error(CHANNEL_CLOSED_EXCEPTION); } channelSubscriptionMonitor.update(newInterest); notificationMultiplexer.update(newInterest); Observable<Void> toReturn = transport.acknowledge(); subscribeToTransportSend(toReturn, "acknowledgment"); // Subscribe eagerly and not require the caller to subscribe. return toReturn; }
Set<String> newInstances = new HashSet<>(); boolean newFullRegistry = false; for (Interest<InstanceInfo> basicInterest : getBasicInterests(newInterests)) { if (basicInterest instanceof InstanceInterest) { newInstances.add(((InstanceInterest) basicInterest).getInstanceId());
this.metrics = metrics; this.notificationMultiplexer = new InterestNotificationMultiplexer(registry); this.channelSubscriptionMonitor = new ChannelSubscriptionMonitor(metrics);
@Override public void _close() { if (state.compareAndSet(STATES.Open, STATES.Closed)) { state.set(STATES.Closed); channelSubscriptionMonitor.update(Interests.forNone()); metrics.stateTransition(STATES.Open, STATES.Closed); notificationMultiplexer.unregister(); super._close(); // Shutdown the transport } } }