diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b1a88e2a..bb8c5681 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -19,15 +19,15 @@ picocli = "4.7.6" restAssured = "5.4.0" javaxAnnotation = "1.3.2" -versionsPlugin = "0.50.0" +versionsPlugin = "0.51.0" errorPronePlugin = "3.1.0" -spotlessPlugin = "6.23.3" +spotlessPlugin = "6.25.0" shadowPlugin = "8.1.1" testLoggerPlugin = "4.0.0" protobufPlugin = "0.9.4" -nexusPublishPlugin = "1.3.0" -axionReleasePlugin = "1.16.1" -testRetryPlugin = "1.5.8" +nexusPublishPlugin = "2.0.0" +axionReleasePlugin = "1.17.2" +testRetryPlugin = "1.5.9" [libraries] 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 797b6ddf..d20512d5 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 @@ -23,13 +23,14 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import io.etcd.jetcd.ByteSequence; import io.etcd.jetcd.Watch; -import io.etcd.jetcd.api.*; +import io.etcd.jetcd.api.VertxWatchGrpc; +import io.etcd.jetcd.api.WatchCancelRequest; +import io.etcd.jetcd.api.WatchCreateRequest; +import io.etcd.jetcd.api.WatchProgressRequest; +import io.etcd.jetcd.api.WatchRequest; +import io.etcd.jetcd.api.WatchResponse; import io.etcd.jetcd.common.exception.ErrorCode; import io.etcd.jetcd.common.exception.EtcdException; import io.etcd.jetcd.options.OptionsUtil; @@ -37,7 +38,6 @@ import io.etcd.jetcd.support.Errors; import io.etcd.jetcd.support.Util; import io.grpc.Status; -import io.vertx.core.streams.ReadStream; import io.vertx.core.streams.WriteStream; import com.google.common.base.Strings; @@ -46,7 +46,14 @@ import com.google.common.util.concurrent.ListeningScheduledExecutorService; import com.google.common.util.concurrent.MoreExecutors; -import static io.etcd.jetcd.common.exception.EtcdExceptionFactory.*; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static io.etcd.jetcd.common.exception.EtcdExceptionFactory.newClosedWatchClientException; +import static io.etcd.jetcd.common.exception.EtcdExceptionFactory.newCompactedException; +import static io.etcd.jetcd.common.exception.EtcdExceptionFactory.newEtcdException; +import static io.etcd.jetcd.common.exception.EtcdExceptionFactory.toEtcdException; /** * watch Implementation. @@ -117,10 +124,8 @@ final class WatcherImpl implements Watcher { private final Listener listener; private final AtomicBoolean closed; - //private StreamObserver stream; private final AtomicReference> wstream; private final AtomicBoolean started; - private ReadStream rstream; private long revision; private long id; @@ -132,7 +137,6 @@ final class WatcherImpl implements Watcher { this.started = new AtomicBoolean(); this.wstream = new AtomicReference<>(); - this.rstream = null; this.id = -1; this.revision = this.option.getRevision(); } @@ -154,7 +158,7 @@ void resume() { } if (started.compareAndSet(false, true)) { - // id is not really useful today but it may be in etcd 3.4 + // id is not really useful today, but it may be in etcd 3.4 id = -1; WatchCreateRequest.Builder builder = WatchCreateRequest.newBuilder() @@ -166,7 +170,7 @@ void resume() { .map(endKey -> Util.prefixNamespaceToRangeEnd(endKey, namespace)) .ifPresent(builder::setRangeEnd); - if (!option.getEndKey().isPresent() && option.isPrefix()) { + if (option.getEndKey().isEmpty() && option.isPrefix()) { ByteSequence endKey = OptionsUtil.prefixEndOf(key); builder.setRangeEnd(Util.prefixNamespaceToRangeEnd(endKey, namespace)); } @@ -179,7 +183,7 @@ void resume() { builder.addFilters(WatchCreateRequest.FilterType.NOPUT); } - rstream = Util.applyRequireLeader(option.withRequireLeader(), stub) + var ignored = Util.applyRequireLeader(option.withRequireLeader(), stub) .watchWithHandler( stream -> { wstream.set(stream);