michaeljmarshall commented on a change in pull request #10199:
URL: https://github.com/apache/pulsar/pull/10199#discussion_r612916574
##########
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:
@lhotari - you're right, it is correct as written. I had a small
misunderstanding about the guarantees of the `synchronized` keyword. (When the
method's lock is released, the updates to `attached` will be flushed to main
memory and then when the method's lock is re-acquired, another thread will have
a consistent view of the variable.) Sorry for the confusion!
--
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:
[email protected]