com.netflix.eureka2.client.channel.InterestChannelInvoker Maven / Gradle / Ivy
package com.netflix.eureka2.client.channel;
import com.netflix.eureka2.interests.Interest;
import com.netflix.eureka2.registry.InstanceInfo;
import com.netflix.eureka2.service.InterestChannel;
import com.netflix.eureka2.utils.SerializedTaskInvoker;
import rx.Observable;
import java.util.concurrent.Callable;
/**
* A decorator of {@link InterestChannel} which delegates to an actual {@link InterestChannel} making sure that all
* operations on the underlying channel are strictly sequenced in the order they arrive on this channel.
*
* @author Nitesh Kant
*/
/*pkg-private: Used by EurekaClientService only*/class InterestChannelInvoker extends SerializedTaskInvoker
implements ClientInterestChannel {
private final ClientInterestChannel delegate;
InterestChannelInvoker(ClientInterestChannel delegate) {
this.delegate = delegate;
}
@Override
public Observable change(final Interest newInterest) {
return submitForAck(new Callable>() {
@Override
public Observable call() throws Exception {
return delegate.change(newInterest);
}
});
}
@Override
public void close() {
try {
shutdown();
} finally {
delegate.close();
}
}
@Override
public Observable asLifecycleObservable() {
return delegate.asLifecycleObservable();
}
@Override
public Observable appendInterest(final Interest toAppend) {
return submitForAck(new Callable>() {
@Override
public Observable call() throws Exception {
return delegate.appendInterest(toAppend);
}
});
}
@Override
public Observable removeInterest(final Interest toRemove) {
return submitForAck(new Callable>() {
@Override
public Observable call() throws Exception {
return delegate.removeInterest(toRemove);
}
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy