From f5865d5bf29ab0205239b1831013fbf5cb4584d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BB=B6?= <1060026287@qq.com> Date: Thu, 10 Dec 2020 08:21:23 +0800 Subject: [PATCH] examples: Modify the way of getHedgingServiceConfig in io.grpc.examples.hedging.HedgingHelloWorldClient (#7700) --- .../hedging/HedgingHelloWorldClient.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/src/main/java/io/grpc/examples/hedging/HedgingHelloWorldClient.java b/examples/src/main/java/io/grpc/examples/hedging/HedgingHelloWorldClient.java index 796772ce0d..30f7beb49a 100644 --- a/examples/src/main/java/io/grpc/examples/hedging/HedgingHelloWorldClient.java +++ b/examples/src/main/java/io/grpc/examples/hedging/HedgingHelloWorldClient.java @@ -51,21 +51,21 @@ public class HedgingHelloWorldClient { /** Construct client connecting to HelloWorld server at {@code host:port}. */ public HedgingHelloWorldClient(String host, int port, boolean hedging) { - Map hedgingServiceConfig = - new Gson() - .fromJson( - new JsonReader( - new InputStreamReader( - HedgingHelloWorldClient.class.getResourceAsStream( - "hedging_service_config.json"), - UTF_8)), - Map.class); ManagedChannelBuilder channelBuilder = ManagedChannelBuilder.forAddress(host, port) // Channels are secure by default (via SSL/TLS). For the example we disable TLS to avoid // needing certificates. .usePlaintext(); if (hedging) { + Map hedgingServiceConfig = + new Gson() + .fromJson( + new JsonReader( + new InputStreamReader( + HedgingHelloWorldClient.class.getResourceAsStream( + "hedging_service_config.json"), + UTF_8)), + Map.class); channelBuilder.defaultServiceConfig(hedgingServiceConfig).enableRetry(); } channel = channelBuilder.build();