First attempt at supporting builds with Java 11
Includes:
- Bump protobuf to 3.8.0 and grpc-java to 1.21.0 (along with transitive
dependencies such as Netty)
- Add jaxb_api at compile time when needed (removed in JDK 11)
- Bump Bnd to 4.1 (adds support for Java 11)
To build with JDK 11, uncomment lines in .bazelrc.
Tested with Bazel 0.26.0.
Change-Id: Ib8e0c7310eacf97328762606e57c01e4834e5565
diff --git a/protocols/grpc/utils/BUILD b/protocols/grpc/utils/BUILD
index 25a78ad..c3e6e77 100644
--- a/protocols/grpc/utils/BUILD
+++ b/protocols/grpc/utils/BUILD
@@ -1,6 +1,6 @@
COMPILE_DEPS = CORE_DEPS + [
"//protocols/grpc/api:onos-protocols-grpc-api",
- "//lib:io_grpc_grpc_core_context",
+ "//lib:io_grpc_grpc_api_context",
]
osgi_jar(
diff --git a/protocols/grpc/utils/src/main/java/org/onosproject/grpc/utils/AbstractGrpcHandshaker.java b/protocols/grpc/utils/src/main/java/org/onosproject/grpc/utils/AbstractGrpcHandshaker.java
index 4cfb63b..cc06d9e 100644
--- a/protocols/grpc/utils/src/main/java/org/onosproject/grpc/utils/AbstractGrpcHandshaker.java
+++ b/protocols/grpc/utils/src/main/java/org/onosproject/grpc/utils/AbstractGrpcHandshaker.java
@@ -90,12 +90,7 @@
.orElseThrow(() -> new IllegalStateException(
"Missing gRPC channel in controller"));
} else {
- try {
- channel = channelController.create(netcfgUri);
- } catch (IllegalArgumentException ex) {
- throw new IllegalStateException(
- "A gRPC channel with same URI already exists", ex);
- }
+ channel = channelController.create(netcfgUri);
// Store channel URI for future use.
CHANNEL_URIS.put(deviceId, netcfgUri);
// Trigger connection.
@@ -178,7 +173,7 @@
.removeDeviceAgentListener(data().deviceId(), providerId);
}
- private void resetChannelConnectBackoffIfNeeded() {
+ private void resetChannelConnectBackoffIfNeeded() {
// Stimulate channel reconnect if in failure state.
final ManagedChannel channel = getExistingChannel();
if (channel == null) {
@@ -186,7 +181,7 @@
return;
}
if (channel.getState(false)
- .equals(ConnectivityState.TRANSIENT_FAILURE)) {
+ .equals(ConnectivityState.TRANSIENT_FAILURE)) {
channel.resetConnectBackoff();
}
}