|
|
|
@ -79,6 +79,7 @@ public class EdgeGrpcClient implements EdgeRpcClient { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
} |
|
|
|
gracefulShutdown(); |
|
|
|
channel = builder.build(); |
|
|
|
EdgeRpcServiceGrpc.EdgeRpcServiceStub stub = EdgeRpcServiceGrpc.newStub(channel); |
|
|
|
log.info("[{}] Sending a connect request to the TB!", edgeKey); |
|
|
|
@ -89,6 +90,16 @@ public class EdgeGrpcClient implements EdgeRpcClient { |
|
|
|
.build()); |
|
|
|
} |
|
|
|
|
|
|
|
private void gracefulShutdown() { |
|
|
|
try { |
|
|
|
if (channel != null) { |
|
|
|
channel.shutdown().awaitTermination(timeoutSecs, TimeUnit.SECONDS); |
|
|
|
} |
|
|
|
} catch (InterruptedException e) { |
|
|
|
log.debug("Error during shutdown of the previous channel", e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void disconnect() throws InterruptedException { |
|
|
|
inputStream.onCompleted(); |
|
|
|
|