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


##########
pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/GrowableArrayBlockingQueue.java:
##########
@@ -127,6 +132,13 @@ public boolean offer(T e) {
 
     @Override
     public void put(T e) {
+        if (terminated){

Review Comment:
   @315157973 
   > If we don't lock first and then judge, it seems that there will be legacy 
messages
   
   Now the terminal method executes as follows:
   - set variable: `terminal state`
   - set variable: `itemAfterTerminatedHandler`
     - Used to release resources for subsequent put
   - get the lock `tailLock` and release it
     - Used to wait for "the remaining logic of the put method"
   
   For example:
   
   |  put   | terminate  |
   |  ----  | ----  |
   | execute if (terminated) {...}  |
   |  |  update variables |
   | Execute the remaining logic of the put method |
   |  |  <strong>(Highlight)</strong>wait for "the remaining logic of the put 
method" |



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