Skip to content

Commit

Permalink
Avoid closing multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
Pil0tXia committed Apr 11, 2024
1 parent f5898d8 commit 774397f
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class SubStreamHandler<T> extends Thread implements Serializable {

private final transient CountDownLatch latch = new CountDownLatch(1);

private volatile boolean isClosed = false;

private final transient ConsumerServiceStub consumerAsyncClient;

private final transient EventMeshGrpcClientConfig clientConfig;
Expand Down Expand Up @@ -130,6 +132,12 @@ public void run() {
}

public void close() {
// Avoid closing multiple times
if (isClosed) {
return;
}
isClosed = true;

if (this.sender != null) {
senderOnComplete();
}
Expand Down

0 comments on commit 774397f

Please sign in to comment.