diff options
author | gjoranv <gv@verizonmedia.com> | 2021-10-07 10:34:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-07 10:34:07 +0200 |
commit | a2583ae58adfd37f6a3822bdd796e9daa50131e0 (patch) | |
tree | bf4ae102968248d70705d45facaeb6902cba6d0b /config | |
parent | 972c8fdf7312161c134f402a618cde06f13e1a45 (diff) | |
parent | 1ea7116333f2ef811ac1b927db9477012cc56cd9 (diff) |
Merge pull request #19442 from vespa-engine/hmusum/remove-use-of-old-method-for-swithcing-connection
setError() -> switchConnection() and remove setError()
Diffstat (limited to 'config')
5 files changed, 7 insertions, 23 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(); } |