diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/remote/RemoteUtils.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/remote/RemoteUtils.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteUtils.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteUtils.java index 9747e3ef11..89ecf43b2e 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/RemoteUtils.java +++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteUtils.java @@ -24,19 +24,24 @@ import java.net.URISyntaxException; /** Helper methods for gRPC calls */ @ThreadSafe public final class RemoteUtils { - public static ManagedChannel createChannel(String hostAndPort) + public static ManagedChannel createChannelLegacy(String hostAndPort) throws InvalidConfigurationException { try { - URI uri = new URI("dummy://" + hostAndPort); - if (uri.getHost() == null || uri.getPort() == -1) { - throw new URISyntaxException("Invalid host or port.", ""); - } - return NettyChannelBuilder.forAddress(uri.getHost(), uri.getPort()) - .usePlaintext(true) - .build(); + return createChannel(hostAndPort); } catch (URISyntaxException e) { throw new InvalidConfigurationException( "Invalid argument for the address of remote cache server: " + hostAndPort); } } + + public static ManagedChannel createChannel(String hostAndPort) + throws URISyntaxException { + URI uri = new URI("dummy://" + hostAndPort); + if (uri.getHost() == null || uri.getPort() == -1) { + throw new URISyntaxException("Invalid host or port.", ""); + } + return NettyChannelBuilder.forAddress(uri.getHost(), uri.getPort()) + .usePlaintext(true) + .build(); + } } |