From 3cf7a16ab281cc5a2bde4dd608f25e8b074efd7e Mon Sep 17 00:00:00 2001 From: Bjørn Christian Seime Date: Thu, 23 May 2019 21:27:02 +0200 Subject: Remove usage of deprecated Method constructor --- .../java/com/yahoo/vespa/config/JRTMethods.java | 5 ----- .../yahoo/vespa/config/benchmark/StressTester.java | 22 ++++++++-------------- 2 files changed, 8 insertions(+), 19 deletions(-) (limited to 'config/src') diff --git a/config/src/main/java/com/yahoo/vespa/config/JRTMethods.java b/config/src/main/java/com/yahoo/vespa/config/JRTMethods.java index 1f9bd66972f..bc0c9cdec51 100644 --- a/config/src/main/java/com/yahoo/vespa/config/JRTMethods.java +++ b/config/src/main/java/com/yahoo/vespa/config/JRTMethods.java @@ -14,11 +14,6 @@ public class JRTMethods { private static final String configV3GetConfigRequestTypes = "s"; private static final String configV3GetConfigResponseTypes = "sx"; - public static Method createConfigV3GetConfigMethod(Object handler, String handlerMethod) { - return addDescriptions( - new Method(configV3getConfigMethodName, configV3GetConfigRequestTypes, configV3GetConfigResponseTypes, handler, handlerMethod)); - } - public static Method createConfigV3GetConfigMethod(MethodHandler methodHandler) { return addDescriptions( new Method(configV3getConfigMethodName, configV3GetConfigRequestTypes, configV3GetConfigResponseTypes, methodHandler)); diff --git a/config/src/main/java/com/yahoo/vespa/config/benchmark/StressTester.java b/config/src/main/java/com/yahoo/vespa/config/benchmark/StressTester.java index a7076d0e32a..4234a6deff1 100644 --- a/config/src/main/java/com/yahoo/vespa/config/benchmark/StressTester.java +++ b/config/src/main/java/com/yahoo/vespa/config/benchmark/StressTester.java @@ -176,7 +176,7 @@ public class StressTester { RpcServer(String host, int port, StressTester tester) { this.tester = tester; - setUp(this); + setUp(); spec = new Spec(host, port); } @@ -194,7 +194,7 @@ public class StressTester { supervisor.transport().shutdown().join(); } - public final void start(Request request) { + private void start(Request request) { debug("start: Got " + request); int ret = 1; int clients = request.parameters().get(0).asInt32(); @@ -210,7 +210,7 @@ public class StressTester { request.returnValues().add(new Int32Value(ret)); } - public final void verify(Request request) { + private void verify(Request request) { debug("verify: Got " + request); long generation = request.parameters().get(0).asInt64(); String verificationFile = request.parameters().get(1).asString(); @@ -235,7 +235,7 @@ public class StressTester { request.returnValues().add(new StringValue(errorMessage)); } - public final void stop(Request request) { + private void stop(Request request) { debug("stop: Got " + request); int ret = 1; try { @@ -250,26 +250,20 @@ public class StressTester { /** * Set up RPC method handlers. - * - * @param handler a MethodHandler that will handle the RPC methods */ - - protected void setUp(Object handler) { - supervisor.addMethod(new Method("start", "i", "i", - handler, "start") + protected void setUp() { + supervisor.addMethod(new Method("start", "i", "i", this::start) .methodDesc("start") .paramDesc(0, "clients", "number of clients") .returnDesc(0, "ret code", "return code, 0 is OK")); - supervisor.addMethod(new Method("verify", "lsl", "is", - handler, "verify") + supervisor.addMethod(new Method("verify", "lsl", "is", this::verify) .methodDesc("verify") .paramDesc(0, "generation", "config generation") .paramDesc(1, "verification file", "name of verification file") .paramDesc(2, "timeout", "timeout when verifying") .returnDesc(0, "ret code", "return code, 0 is OK") .returnDesc(1, "error message", "error message, if non zero return code")); - supervisor.addMethod(new Method("stop", "", "i", - handler, "stop") + supervisor.addMethod(new Method("stop", "", "i", this::stop) .methodDesc("stop") .returnDesc(0, "ret code", "return code, 0 is OK")); } -- cgit v1.2.3