Update gRPC
- Update gRPC and it's dependencies to 0.13.2
- Use pre-defined default port if not specified by URI
- Cosmetic fixes
Change-Id: Iac8c3ba4c6fe1b5925ea8832e61d313adfad6f71
diff --git a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceProvider.java b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceProvider.java
index 71a83c9..955a657 100644
--- a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceProvider.java
+++ b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceProvider.java
@@ -58,7 +58,7 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected RemoteServiceProviderRegistry rpcRegistry;
- private Map<URI, ManagedChannel> channels = new ConcurrentHashMap<>();
+ private final Map<URI, ManagedChannel> channels = new ConcurrentHashMap<>();
private RemoteServiceContextProviderService providerService;
@@ -67,8 +67,8 @@
protected void activate() {
providerService = rpcRegistry.register(this);
- // FIXME remove me. test code to see if gRPC loads in karaf
- //getChannel(URI.create("grpc://localhost:8080"));
+ // Uncomment to test if gRPC can be loaded in karaf
+ //getChannel(URI.create("grpc://localhost:11984"));
log.info("Started");
}
@@ -111,7 +111,11 @@
private ManagedChannel createChannel(URI uri) {
log.debug("Creating channel for {}", uri);
- return NettyChannelBuilder.forAddress(uri.getHost(), uri.getPort())
+ int port = GrpcRemoteServiceServer.DEFAULT_LISTEN_PORT;
+ if (uri.getPort() != -1) {
+ port = uri.getPort();
+ }
+ return NettyChannelBuilder.forAddress(uri.getHost(), port)
.negotiationType(NegotiationType.PLAINTEXT)
.build();
}