Skip to content

Commit de93757

Browse files
sophiatevSophia Tevosyan
andauthored
Fixing gRPC channel shutdown (#249)
Co-authored-by: Sophia Tevosyan <[email protected]>
1 parent 31ead9c commit de93757

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

client/src/main/java/com/microsoft/durabletask/DurableTaskGrpcClient.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,16 @@ public final class DurableTaskGrpcClient extends DurableTaskClient {
7171
public void close() {
7272
if (this.managedSidecarChannel != null) {
7373
try {
74-
this.managedSidecarChannel.shutdown().awaitTermination(5, TimeUnit.SECONDS);
74+
if (!this.managedSidecarChannel.shutdown().awaitTermination(5, TimeUnit.SECONDS))
75+
{
76+
this.managedSidecarChannel.shutdownNow();
77+
}
7578
} catch (InterruptedException e) {
7679
// Best effort. Also note that AutoClose documentation recommends NOT having
7780
// close() methods throw InterruptedException:
7881
// https://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html
82+
this.managedSidecarChannel.shutdownNow();
83+
Thread.currentThread().interrupt();
7984
}
8085
}
8186
}

0 commit comments

Comments
 (0)