From 32c8d17704dc099dda2417f556ceff8960cb930a Mon Sep 17 00:00:00 2001 From: Giri Ramasamy <46867712+giri-vsr@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:19:56 +0530 Subject: [PATCH] watcher: Register Exception Handler before watch request --- gradle/libs.versions.toml | 2 +- jetcd-core/src/main/java/io/etcd/jetcd/impl/WatchImpl.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1ad29bff..4a0e1fa0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,7 +14,7 @@ commonsIo = "2.15.1" commonCompress = "1.25.0" autoService = "1.1.1" errorprone = "2.23.0" -vertx = "4.5.0" +vertx = "4.5.1" picocli = "4.7.5" restAssured = "5.3.2" diff --git a/jetcd-core/src/main/java/io/etcd/jetcd/impl/WatchImpl.java b/jetcd-core/src/main/java/io/etcd/jetcd/impl/WatchImpl.java index d60a875a..21623ec5 100644 --- a/jetcd-core/src/main/java/io/etcd/jetcd/impl/WatchImpl.java +++ b/jetcd-core/src/main/java/io/etcd/jetcd/impl/WatchImpl.java @@ -178,13 +178,12 @@ void resume() { builder.addFilters(WatchCreateRequest.FilterType.NOPUT); } - rstream = Util.applyRequireLeader(option.withRequireLeader(), stub).watch(stream -> { + rstream = Util.applyRequireLeader(option.withRequireLeader(), stub).watchWithExceptionHandler(stream -> { wstream.set(stream); stream.write(WatchRequest.newBuilder().setCreateRequest(builder).build()); - }); + }, this::onError); rstream.handler(this::onNext); - rstream.exceptionHandler(this::onError); rstream.endHandler(event -> onCompleted()); } }