use of io.etcd.jetcd.common.exception.EtcdExceptionFactory.toEtcdException in project jetcd by coreos.
the class ElectionImpl method observe.
@Override
public void observe(ByteSequence electionName, Listener listener) {
checkNotNull(electionName, "election name should not be null");
checkNotNull(listener, "listener should not be null");
LeaderRequest request = LeaderRequest.newBuilder().setName(ByteString.copyFrom(electionName.getBytes())).build();
stub.observe(request).handler(value -> listener.onNext(new LeaderResponse(value, namespace))).endHandler(ignored -> listener.onCompleted()).exceptionHandler(error -> listener.onError(EtcdExceptionFactory.toEtcdException(error)));
}
Aggregations