aboutsummaryrefslogtreecommitdiffstats
path: root/grpc
diff options
context:
space:
mode:
authorpriyanka.akhade <priyanka.akhade@huawei.com>2020-06-18 15:11:08 +0530
committerpriyanka.akhade <priyanka.akhade@huawei.com>2020-07-01 09:51:04 +0530
commit268be523fb1142138a3f710642b5773453841eeb (patch)
tree2e88b62a1e3059a050335d2f19467e3d2d451a41 /grpc
parenta13ffa03bf353bc70cb20cc0481ba89e24fd2cdb (diff)
code improvements
Signed-off-by: priyanka.akhade <priyanka.akhade@huawei.com> Issue-ID: CLI-270 Change-Id: If9eab4bc8642c7c20a841d58c8a9e2bf5ae6c98b
Diffstat (limited to 'grpc')
-rw-r--r--grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java10
-rw-r--r--grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java8
2 files changed, 9 insertions, 9 deletions
diff --git a/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java b/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java
index e32110de..efc941f9 100644
--- a/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java
+++ b/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java
@@ -82,17 +82,17 @@ public class OpenInterfaceGrpcClient {
}
public Output invoke(Input input) throws OpenInterfaceGrpcTimeoutExecption {
- logger.info("Input " + input.toString());
+ logger.info("Input {}", input);
Output result = Output.newBuilder().build();
try {
result = blockingStub.withDeadlineAfter(timeout, TimeUnit.MILLISECONDS).invoke(input);
} catch (StatusRuntimeException e) {
- logger.warn("RPC failed: {0}", e.getStatus());
+ logger.warn("RPC failed: {}", e.getStatus());
//Status{code=DEADLINE_EXCEEDED}
throw new OpenInterfaceGrpcTimeoutExecption(e.getMessage());
}
- logger.info("Output: " + result.toString());
+ logger.info("Output: {}", result);
return result;
}
@@ -103,12 +103,12 @@ public class OpenInterfaceGrpcClient {
try {
result = blockingStub.withDeadlineAfter(timeout, TimeUnit.MILLISECONDS).remoteCli(args);
} catch (StatusRuntimeException e) {
- logger.warn("RPC failed: {0}", e.getStatus());
+ logger.warn("RPC failed: {}", e.getStatus());
//Status{code=DEADLINE_EXCEEDED}
throw new OpenInterfaceGrpcTimeoutExecption(e.getMessage());
}
- logger.info("Result: " + result.toString());
+ logger.info("Result: {}", result);
return result;
}
}
diff --git a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
index d59416c7..9f236e5c 100644
--- a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
+++ b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
@@ -75,7 +75,7 @@ public class OpenInterfaceGrpcServer {
.addService(new OpenInterfaceGrpcImpl())
.build()
.start();
- logger.info("Server started, listening on " + port);
+ logger.info("Server started, listening on {}", port);
try {
OnapCommandRegistrar.getRegistrar().setHost(host);
@@ -140,7 +140,7 @@ public class OpenInterfaceGrpcServer {
@Override
public void invoke(Input req, StreamObserver<Output> responseObserver) {
Output output = null;
- logger.info(req.toString());
+ logger.info("{}", req);
String product = req.getOptionsMap().get(OnapCommandConstants.RPC_PRODUCT);
String format = req.getOptionsMap().getOrDefault(OnapCommandConstants.DEFAULT_PARAMETER_OUTPUT_FORMAT, OnapCommandResultType.JSON.name().toLowerCase());
@@ -252,7 +252,7 @@ public class OpenInterfaceGrpcServer {
}
output = reply.build();
- logger.info(output.toString());
+ logger.info("{}", output);
} else {
//Rpc command will set the output.
output = (Output) cmd.getResult().getOutput();
@@ -284,7 +284,7 @@ public class OpenInterfaceGrpcServer {
@Override
public void remoteCli(Args req, StreamObserver<Result> responseObserver) {
- logger.info(req.toString());
+ logger.info("{}", req);
List<String> args = new ArrayList<>();
if (req.getRequestId() != null) {