diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2020-01-06 21:06:26 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2020-01-06 21:06:26 +0100 |
commit | 1f6753d9d0f35a4a6612987fe8c6ea42ff166495 (patch) | |
tree | 0cfd3557a7400b7178b5dd6aa884d3407237d552 /jrt | |
parent | cc711b5a8fbc1a7a5897f8ee1761103fcb89e644 (diff) |
Non-functional changes
Diffstat (limited to 'jrt')
-rw-r--r-- | jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java | 2 | ||||
-rw-r--r-- | jrt/src/com/yahoo/jrt/tool/RpcInvoker.java | 46 |
2 files changed, 24 insertions, 24 deletions
diff --git a/jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java b/jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java index 31d7543304a..5a4a79995d8 100644 --- a/jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java +++ b/jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java @@ -133,9 +133,9 @@ public class Mirror implements IMirror { * and end with '**' to match the rest of the name. * Note that this isn't quite globbing, as there is no backtracking. * - * @return true if the name matches the pattern * @param name the name * @param pattern the pattern + * @return true if the name matches the pattern */ static boolean match(char [] name, char [] pattern) { int ni = 0; diff --git a/jrt/src/com/yahoo/jrt/tool/RpcInvoker.java b/jrt/src/com/yahoo/jrt/tool/RpcInvoker.java index 7803767e4d0..6c36e8f9604 100644 --- a/jrt/src/com/yahoo/jrt/tool/RpcInvoker.java +++ b/jrt/src/com/yahoo/jrt/tool/RpcInvoker.java @@ -28,10 +28,10 @@ import java.util.ArrayList; public class RpcInvoker { private Value getArgument(Request request, String parameter) { - if (parameter.length()<=1 || parameter.charAt(1)!=':') + if (parameter.length() <= 1 || parameter.charAt(1) != ':') return new StringValue(parameter); - String value=parameter.substring(2); + String value = parameter.substring(2); switch (parameter.charAt(0)) { case 'b': return new Int8Value(Byte.parseByte(value)); @@ -53,9 +53,9 @@ public class RpcInvoker { "There is no jrt type identified by '" + parameter.charAt(0) + "'"); } - protected Request createRequest(String method,List<String> arguments) { - Request request=new Request(method); - if (arguments!=null) { + protected Request createRequest(String method, List<String> arguments) { + Request request = new Request(method); + if (arguments != null) { for (String argument : arguments) request.parameters().add(getArgument(request,argument)); } @@ -69,37 +69,37 @@ public class RpcInvoker { * @param method the name of the method to invoke * @param arguments the argument to the method, or null or an empty list if there are no arguments */ - public void invoke(String connectspec,String method, List<String> arguments) { - Supervisor supervisor=null; - Target target=null; + public void invoke(String connectspec, String method, List<String> arguments) { + Supervisor supervisor = null; + Target target = null; try { - if (connectspec.indexOf('/')<0) - connectspec="tcp/" + connectspec; + if (connectspec.indexOf('/') < 0) + connectspec = "tcp/" + connectspec; - supervisor=new Supervisor(new Transport()); + supervisor = new Supervisor(new Transport()); target = supervisor.connect(new Spec(connectspec)); - Request request=createRequest(method,arguments); + Request request = createRequest(method,arguments); target.invokeSync(request,10.0); if (request.isError()) { System.err.println("error(" + request.errorCode() + "): " + request.errorMessage()); return; } - Values returned=request.returnValues(); - for (int i=0; i<returned.size(); i++) { + Values returned = request.returnValues(); + for (int i = 0; i < returned.size(); i++) { System.out.println(returned.get(i)); } } finally { - if (target!=null) + if (target != null) target.close(); - if (supervisor!=null) + if (supervisor != null) supervisor.transport().shutdown().join(); } } public static void main(String[] args) { - if (args.length<1) { + if (args.length < 1) { System.err.println("usage: invoke [-h <connectspec>] <method> [arguments]"); System.err.println(" Connectspec: This is on the form hostname:port, or tcp/hostname:port"); System.err.println(" if omitted, localhost:8086 is used"); @@ -107,14 +107,14 @@ public class RpcInvoker { System.err.println(" supported types: {'b','h','i','l','f','d','s'}"); System.exit(0); } - List<String> arguments=new ArrayList<String>(Arrays.asList(args)); - String connectSpec="localhost:8086"; - if ("-h".equals(arguments.get(0)) && arguments.size()>=3) { + List<String> arguments = new ArrayList<String>(Arrays.asList(args)); + String connectSpec = "localhost:8086"; + if ("-h".equals(arguments.get(0)) && arguments.size() >= 3) { arguments.remove(0); // Consume -h - connectSpec=arguments.remove(0); + connectSpec = arguments.remove(0); } - String method=arguments.remove(0); - new RpcInvoker().invoke(connectSpec,method,arguments); + String method = arguments.remove(0); + new RpcInvoker().invoke(connectSpec, method, arguments); } } |