Shutdown before re-opening
This commit is contained in:
parent
138a0ba581
commit
c677b1bdc3
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user