From fbfbd9f1d8afa4660750bb0bd8cffe0dfd682ca2 Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Sun, 8 Sep 2019 11:00:04 +0200 Subject: Fix mode switching Use the new mode when switching and log correctly --- .../src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java index cd515383950..d77206aee81 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java @@ -114,8 +114,9 @@ public class ProxyServer implements Runnable { void setMode(String modeName) { if (modeName.equals(this.mode.name())) return; - String oldMode = this.mode.name(); - switch (mode.getMode()) { + Mode oldMode = this.mode; + Mode newMode = new Mode(modeName); + switch (newMode.getMode()) { case MEMORYCACHE: configClient.shutdownSourceConnections(); configClient = new MemoryCacheConfigClient(memoryCache); @@ -129,7 +130,7 @@ public class ProxyServer implements Runnable { default: throw new IllegalArgumentException("Cannot set invalid mode '" + modeName + "'"); } - log.log(LogLevel.INFO, "Switching from '" + oldMode + "' mode to '" + modeName.toLowerCase() + "' mode"); + log.log(LogLevel.INFO, "Switched from '" + oldMode.name().toLowerCase() + "' mode to '" + getMode().name().toLowerCase() + "' mode"); } private ConfigSourceClient createClient(RpcServer rpcServer, DelayedResponses delayedResponses, -- cgit v1.2.3