Move version compatibility check until after api key obtained by tellet-q · Pull Request #97 · qdrant/java-client
Expand Up
@@ -192,16 +192,14 @@ public void close() {
public static class Builder {
private final ManagedChannel channel;
private final boolean shutdownChannelOnClose;
private final boolean checkCompatibility;
@Nullable private CallCredentials callCredentials;
@Nullable private Duration timeout;
Builder(ManagedChannel channel, boolean shutdownChannelOnClose, boolean checkCompatibility) { this.channel = channel; this.shutdownChannelOnClose = shutdownChannelOnClose; String clientVersion = Builder.class.getPackage().getImplementationVersion(); if (checkCompatibility) { checkVersionsCompatibility(clientVersion); } this.checkCompatibility = checkCompatibility; }
Builder(String host, int port, boolean useTransportLayerSecurity, boolean checkCompatibility) { Expand All @@ -210,9 +208,7 @@ public static class Builder { String userAgent = "java-client/" + clientVersion + " java/" + javaVersion; this.channel = createChannel(host, port, useTransportLayerSecurity, userAgent); this.shutdownChannelOnClose = true; if (checkCompatibility) { checkVersionsCompatibility(clientVersion); } this.checkCompatibility = checkCompatibility; }
/** Expand Down Expand Up @@ -255,6 +251,10 @@ public Builder withCallCredentials(@Nullable CallCredentials callCredentials) { * @return a new instance of {@link QdrantGrpcClient} */ public QdrantGrpcClient build() { if (checkCompatibility) { String clientVersion = Builder.class.getPackage().getImplementationVersion(); checkVersionsCompatibility(clientVersion); } return new QdrantGrpcClient(channel, shutdownChannelOnClose, callCredentials, timeout); }
Expand All @@ -277,6 +277,7 @@ private void checkVersionsCompatibility(String clientVersion) { try { String serverVersion = QdrantGrpc.newBlockingStub(this.channel) .withCallCredentials(this.callCredentials) .healthCheck(QdrantOuterClass.HealthCheckRequest.getDefaultInstance()) .getVersion(); if (!VersionsCompatibilityChecker.isCompatible(clientVersion, serverVersion)) { Expand Down
Builder(ManagedChannel channel, boolean shutdownChannelOnClose, boolean checkCompatibility) { this.channel = channel; this.shutdownChannelOnClose = shutdownChannelOnClose; String clientVersion = Builder.class.getPackage().getImplementationVersion(); if (checkCompatibility) { checkVersionsCompatibility(clientVersion); } this.checkCompatibility = checkCompatibility; }
Builder(String host, int port, boolean useTransportLayerSecurity, boolean checkCompatibility) { Expand All @@ -210,9 +208,7 @@ public static class Builder { String userAgent = "java-client/" + clientVersion + " java/" + javaVersion; this.channel = createChannel(host, port, useTransportLayerSecurity, userAgent); this.shutdownChannelOnClose = true; if (checkCompatibility) { checkVersionsCompatibility(clientVersion); } this.checkCompatibility = checkCompatibility; }
/** Expand Down Expand Up @@ -255,6 +251,10 @@ public Builder withCallCredentials(@Nullable CallCredentials callCredentials) { * @return a new instance of {@link QdrantGrpcClient} */ public QdrantGrpcClient build() { if (checkCompatibility) { String clientVersion = Builder.class.getPackage().getImplementationVersion(); checkVersionsCompatibility(clientVersion); } return new QdrantGrpcClient(channel, shutdownChannelOnClose, callCredentials, timeout); }
Expand All @@ -277,6 +277,7 @@ private void checkVersionsCompatibility(String clientVersion) { try { String serverVersion = QdrantGrpc.newBlockingStub(this.channel) .withCallCredentials(this.callCredentials) .healthCheck(QdrantOuterClass.HealthCheckRequest.getDefaultInstance()) .getVersion(); if (!VersionsCompatibilityChecker.isCompatible(clientVersion, serverVersion)) { Expand Down