diff options
8 files changed, 10 insertions, 32 deletions
diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigRequester.java b/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigRequester.java index dc37559c37e..c88bdf9f3b8 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigRequester.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigRequester.java @@ -164,7 +164,7 @@ public class JRTConfigRequester implements RequestWaiter { log.log(INFO, "Failure of config subscription to " + connection.getAddress() + ", clients will keep existing config until resolved: " + sub); - connectionPool.setError(connection, jrtReq.errorCode()); + connectionPool.switchConnection(connection); failures++; long delay = calculateFailedRequestDelay(failures, timingValues); // The logging depends on whether we are configured or not. diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/MockConnection.java b/config/src/main/java/com/yahoo/config/subscription/impl/MockConnection.java index e9e7f3e7bce..c27e4cb2bc8 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/MockConnection.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/MockConnection.java @@ -1,4 +1,4 @@ -// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config.subscription.impl; import com.yahoo.jrt.Request; @@ -62,9 +62,6 @@ public class MockConnection implements ConnectionPool, Connection { public void close() {} @Override - public void setError(Connection connection, int errorCode) { } - - @Override public Connection getCurrent() { return this; } diff --git a/config/src/main/java/com/yahoo/vespa/config/ConnectionPool.java b/config/src/main/java/com/yahoo/vespa/config/ConnectionPool.java index 93135fc4661..1ee44bfee87 100644 --- a/config/src/main/java/com/yahoo/vespa/config/ConnectionPool.java +++ b/config/src/main/java/com/yahoo/vespa/config/ConnectionPool.java @@ -1,4 +1,4 @@ -// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config; import com.yahoo.jrt.Supervisor; @@ -10,18 +10,11 @@ public interface ConnectionPool extends AutoCloseable { void close(); - /** - * Sets the supplied Connection to have an error, implementations are expected to call - * {@link #switchConnection(Connection)} after setting state for the supplied Connection. - * - */ - void setError(Connection connection, int i); - Connection getCurrent(); /** * Switches to another (healthy, if one exists) Connection instance. - * Returns the resulting Connection. See also {@link #setError(Connection, int)} + * Returns the resulting Connection. * * @return a Connection */ diff --git a/config/src/main/java/com/yahoo/vespa/config/JRTConnectionPool.java b/config/src/main/java/com/yahoo/vespa/config/JRTConnectionPool.java index 78580328bf9..f4876826492 100644 --- a/config/src/main/java/com/yahoo/vespa/config/JRTConnectionPool.java +++ b/config/src/main/java/com/yahoo/vespa/config/JRTConnectionPool.java @@ -1,4 +1,4 @@ -// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config; import com.yahoo.config.subscription.ConfigSourceSet; @@ -18,7 +18,6 @@ import java.util.logging.Logger; * The current connection is chosen randomly when calling {#link {@link #switchConnection()}} * (it will continue to use the same connection if there is only one source). * The current connection is available with {@link #getCurrent()}. - * When calling {@link #setError(Connection, int)}, {@link #switchConnection()} will always be called. * * @author Gunnar Gauslaa Bergem * @author hmusum @@ -115,11 +114,6 @@ public class JRTConnectionPool implements ConnectionPool { return sourceSet; } - @Override - public void setError(Connection connection, int errorCode) { - switchConnection(connection); - } - public JRTConnectionPool updateSources(List<String> addresses) { ConfigSourceSet newSources = new ConfigSourceSet(addresses); return updateSources(newSources); diff --git a/config/src/test/java/com/yahoo/vespa/config/JRTConnectionPoolTest.java b/config/src/test/java/com/yahoo/vespa/config/JRTConnectionPoolTest.java index bfe132c9660..5c0876a2649 100644 --- a/config/src/test/java/com/yahoo/vespa/config/JRTConnectionPoolTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/JRTConnectionPoolTest.java @@ -1,4 +1,4 @@ -// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config; import com.yahoo.config.subscription.ConfigSourceSet; @@ -160,7 +160,7 @@ public class JRTConnectionPoolTest { } private JRTConnection failAndGetNewConnection(JRTConnectionPool connectionPool, Connection failingConnection) { - connectionPool.setError(failingConnection, 123); + connectionPool.switchConnection(failingConnection); return connectionPool.getCurrent(); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionUtil.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionUtil.java index 1985fd534fb..e1cace830a6 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionUtil.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionUtil.java @@ -75,9 +75,6 @@ public class FileDistributionUtil { } @Override - public void setError(Connection connection, int i) {} - - @Override public Connection getCurrent() { return null; } @Override diff --git a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownloader.java b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownloader.java index 949b1b703cd..952684b7b0b 100644 --- a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownloader.java +++ b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownloader.java @@ -1,4 +1,4 @@ -// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.filedistribution; import com.yahoo.concurrent.DaemonThreadFactory; @@ -114,7 +114,7 @@ public class FileReferenceDownloader { log.log(logLevel, () -> "Downloading file " + fileReference + " from " + connection.getAddress() + " failed: " + request + ", error: " + request.errorMessage() + ", will use another config server for next request" + " (retry count " + retryCount + ", rpc timeout " + rpcTimeout.getSeconds() + ")"); - connectionPool.setError(connection, request.errorCode()); + connectionPool.switchConnection(connection); return false; } } diff --git a/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java b/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java index 6169f6fbe55..15cc28007ce 100644 --- a/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java +++ b/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/FileDownloaderTest.java @@ -1,4 +1,4 @@ -// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.filedistribution; import com.yahoo.config.FileReference; @@ -325,9 +325,6 @@ public class FileDownloaderTest { } @Override - public void setError(Connection connection, int errorCode) { } - - @Override public Connection getCurrent() { return this; } |