You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/04/13 06:37:29 UTC

[GitHub] [pulsar] lhotari commented on a change in pull request #10199: Shutdown Broker gracefully, but forcefully after brokerShutdownTimeoutMs

lhotari commented on a change in pull request #10199:
URL: https://github.com/apache/pulsar/pull/10199#discussion_r612167254



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/util/CompletableFutureCancellationHandler.java
##########
@@ -41,10 +41,16 @@
  * any "downstream" dependent futures. A cancellation or timeout that happens in any "upstream"
  * future will get handled.
  */
-class CompletableFutureCancellationHandler {
-    private volatile boolean cancelled;
+public class CompletableFutureCancellationHandler {
+    private enum CompletionStatus {
+        PENDING,
+        CANCELLED,
+        DONE
+    }
+    private volatile CompletionStatus completionStatus = CompletionStatus.PENDING;
     private volatile Runnable cancelAction;
     private final AtomicBoolean cancelHandled = new AtomicBoolean();
+    private boolean attached;

Review comment:
       it should be fine since `attached` is used only in `attachToFuture` method and that method is synchronized. The reason why I added the "attached" field is to prevent misuse of `CompletableFutureCancellationHandler` class. It is designed to be "attached" to a single CompletableFuture and it cannot be reused.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org