SteNicholas commented on code in PR #2452:
URL: https://github.com/apache/celeborn/pull/2452#discussion_r1556998593


##########
worker/src/main/java/org/apache/celeborn/service/deploy/worker/memory/ReadBufferDispatcher.java:
##########
@@ -76,33 +76,44 @@ public void run() {
         logger.info("Buffer dispatcher is closing");
       }
 
-      if (request != null) {
-        long start = System.nanoTime();
-        List<ByteBuf> buffers = new ArrayList<>();
-        int bufferSize = request.getBufferSize();
-        while (buffers.size() < request.getNumber()) {
-          if (memoryManager.readBufferAvailable(bufferSize)) {
-            memoryManager.changeReadBufferCounter(bufferSize);
-            ByteBuf buf = readBufferAllocator.buffer(bufferSize, bufferSize);
-            buffers.add(buf);
-            allocatedReadBuffers.increment();
-          } else {
-            try {
-              // If dispatcher can not allocate requested buffers, it will 
wait here until necessary
-              // buffers are get.
-              Thread.sleep(this.readBufferAllocationWait);
-            } catch (InterruptedException e) {
-              logger.info("Buffer dispatcher is closing");
+      List<ByteBuf> buffers = null;
+      try {
+        if (request != null) {
+          long start = System.nanoTime();
+          int bufferSize = request.getBufferSize();
+          buffers = new ArrayList<>();
+          while (buffers.size() < request.getNumber()) {
+            if (memoryManager.readBufferAvailable(bufferSize)) {
+              ByteBuf buf = readBufferAllocator.buffer(bufferSize, bufferSize);
+              buffers.add(buf);
+              memoryManager.changeReadBufferCounter(bufferSize);
+              allocatedReadBuffers.increment();
+            } else {
+              try {
+                // If dispatcher can not allocate requested buffers, it will 
wait here until
+                // necessary
+                // buffers are get.

Review Comment:
   Nit: move this line after `necessary`.



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