zuston commented on code in PR #2115:
URL: 
https://github.com/apache/incubator-uniffle/pull/2115#discussion_r1776480812


##########
storage/src/main/java/org/apache/uniffle/storage/common/AbstractStorage.java:
##########
@@ -40,17 +41,22 @@ public abstract class AbstractStorage implements Storage {
   abstract ShuffleWriteHandler 
newWriteHandler(CreateShuffleWriteHandlerRequest request);
 
   @Override
-  public ShuffleWriteHandler 
getOrCreateWriteHandler(CreateShuffleWriteHandlerRequest request) {
+  public Pair<ShuffleWriteHandler, Boolean> getOrCreateWriteHandler(

Review Comment:
   ```
   class ShuffleWriteHandlerWrapper {
     private ShuffleWriteHandler handler;
     private boolean isNewlyCreated;
   }
   
   
   @Override
     public ShuffleWriteHandler 
getOrCreateWriteHandler(CreateShuffleWriteHandlerRequest request) {
       writerHandlers.computeIfAbsent(request.getAppId(), key -> 
JavaUtils.newConcurrentMap());
       requests.computeIfAbsent(request.getAppId(), key -> 
JavaUtils.newConcurrentMap());
       Map<String, ShuffleWriteHandler> map = 
writerHandlers.get(request.getAppId());
       String partitionKey =
           RssUtils.generatePartitionKey(
               request.getAppId(), request.getShuffleId(), 
request.getStartPartition());
       map.computeIfAbsent(partitionKey, key -> newWriteHandler(request));
       Map<String, CreateShuffleWriteHandlerRequest> requestMap = 
requests.get(request.getAppId());
       requestMap.putIfAbsent(partitionKey, request);
       ShuffleWriteHandler handler = map.get(partitionKey);
       return new ShuffleWriteHandlerWrapper(handler, true/false);
     }
   ```
   
   like this



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