poorbarcode commented on code in PR #19873:
URL: https://github.com/apache/pulsar/pull/19873#discussion_r1145656305


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/ImmutableBucket.java:
##########
@@ -44,7 +45,12 @@
 class ImmutableBucket extends Bucket {
 
     @Setter
-    private volatile 
List<DelayedMessageIndexBucketSnapshotFormat.SnapshotSegment> snapshotSegments;
+    private List<DelayedMessageIndexBucketSnapshotFormat.SnapshotSegment> 
snapshotSegments;
+
+    boolean merging = false;

Review Comment:
   I think you are right, the document of J2SE describes this feature like this:
   
   #### [Intrinsic Locks and 
Synchronization](https://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html)
   ```
   Synchronization is built around an internal entity known as the intrinsic 
lock or monitor lock. (The API specification often refers to this entity simply 
as a "monitor.") Intrinsic locks play a role in both aspects of 
synchronization: enforcing exclusive access to an object's state and 
establishing happens-before relationships that are essential to visibility.
   ```
   
   #### [Synchronized 
Methods](https://docs.oracle.com/javase/tutorial/essential/concurrency/syncmeth.html)
   ```
   Second, when a synchronized method exits, it automatically establishes a 
happens-before relationship with any subsequent invocation of a synchronized 
method for the same object. This guarantees that changes to the state of the 
object are visible to all threads.
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to