maobaolong commented on PR #2091:
URL: 
https://github.com/apache/incubator-uniffle/pull/2091#issuecomment-2324097431

   > It not thread-safe when iterating over it.
   
   @xianjingfeng Thanks to share this.
   
   And the following trick can resolve the iterator safe issue.
   
   ```java
   List<Object> list = Collections.synchronizedList(new ArrayList<>());
   synchronized (list) {
       Iterator<Object> iterator = list.iterator();
       while (iterator.hasNext()) {
           // ...
       }
   }
   ```
   
   
   > For the job that finally runs successfully, there is at most one element 
in the list, so I think this performance impact is acceptable
   
   I'm just implementing a `partition-split` feature leverage on 
`blockIdsSendFailTracker`, which can invoke the `add` method frequently than 
before. 
   
   If the existing state `add`  is invoked in low frequent, I'm ok for this PR 
and I will resolve the performance down issue in that PR.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to