com.netflix.eureka2.server.channel.InterestChannelImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eureka-server Show documentation
Show all versions of eureka-server Show documentation
eureka-server developed by Netflix
The newest version!
package com.netflix.eureka2.server.channel;
import com.netflix.eureka2.interests.ChangeNotification;
import com.netflix.eureka2.interests.Interest;
import com.netflix.eureka2.interests.Interests;
import com.netflix.eureka2.interests.ModifyNotification;
import com.netflix.eureka2.protocol.EurekaProtocolError;
import com.netflix.eureka2.protocol.discovery.AddInstance;
import com.netflix.eureka2.protocol.discovery.DeleteInstance;
import com.netflix.eureka2.protocol.discovery.InterestRegistration;
import com.netflix.eureka2.protocol.discovery.UnregisterInterestSet;
import com.netflix.eureka2.protocol.discovery.UpdateInstanceInfo;
import com.netflix.eureka2.registry.Delta;
import com.netflix.eureka2.registry.InstanceInfo;
import com.netflix.eureka2.server.channel.InterestChannelImpl.STATES;
import com.netflix.eureka2.server.metric.InterestChannelMetrics;
import com.netflix.eureka2.server.metric.InterestChannelMetrics.ChannelSubscriptionMonitor;
import com.netflix.eureka2.server.registry.EurekaServerRegistry;
import com.netflix.eureka2.channel.InterestChannel;
import com.netflix.eureka2.transport.MessageConnection;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action1;
/**
* An implementation of {@link InterestChannel} for eureka server.
*
* This channel is self contained and does not require any external invocations on the {@link InterestChannel}
* interface.
*
* @author Nitesh Kant
*/
public class InterestChannelImpl extends AbstractChannel implements InterestChannel {
public enum STATES {Idle, Open, Closed}
private final InterestChannelMetrics metrics;
private final InterestNotificationMultiplexer notificationMultiplexer;
private final ChannelSubscriptionMonitor channelSubscriptionMonitor;
public InterestChannelImpl(final EurekaServerRegistry registry, final MessageConnection transport, final InterestChannelMetrics metrics) {
super(STATES.Idle, transport, registry);
this.metrics = metrics;
this.notificationMultiplexer = new InterestNotificationMultiplexer(registry);
this.channelSubscriptionMonitor = new ChannelSubscriptionMonitor(metrics);
subscribeToTransportInput(new Action1