/** * Create a retryable connection that wraps around channels that executes with zero operands. * It is assumed also that the channel does not produce any data. * * @param executeOnChannel a func1 that describes a zero op call for the channel * @return a {@link RetryableConnection} that contains several observables. This lifecycle observable provided * can be retried on. */ public RetryableConnection<CHANNEL> zeroOpConnection(final Func1<CHANNEL, Observable<Void>> executeOnChannel) { Observable<Integer> opStream = Observable.just(1); Func2<CHANNEL, Integer, Observable<Void>> adaptedExecute = new Func2<CHANNEL, Integer, Observable<Void>>() { @Override public Observable<Void> call(CHANNEL channel, Integer integer) { return executeOnChannel.call(channel); } }; return singleOpConnection(opStream, adaptedExecute); }
/* visible for testing*/ EurekaInterestClientImpl(final SourcedEurekaRegistry<InstanceInfo> registry, ChannelFactory<InterestChannel> channelFactory, int retryWaitMillis) { super(registry, retryWaitMillis); this.interestTracker = new InterestTracker(); RetryableConnectionFactory<InterestChannel> retryableConnectionFactory = new RetryableConnectionFactory<>(channelFactory); Observable<Interest<InstanceInfo>> opStream = interestTracker.interestChangeStream(); Func2<InterestChannel, Interest<InstanceInfo>, Observable<Void>> executeOnChannel = new Func2<InterestChannel, Interest<InstanceInfo>, Observable<Void>>() { @Override public Observable<Void> call(InterestChannel interestChannel, Interest<InstanceInfo> interest) { return interestChannel.change(interest); } }; this.retryableConnection = retryableConnectionFactory.singleOpConnection(opStream, executeOnChannel); registryEvictionSubscribe(retryableConnection); lifecycleSubscribe(retryableConnection); }
final RetryableConnection<RegistrationChannel> retryableConnection = retryableConnectionFactory.singleOpConnection( opStream, executeOnChannel