m-trieu commented on code in PR #32774:
URL: https://github.com/apache/beam/pull/32774#discussion_r1814370170


##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/windmill/client/grpc/GrpcGetDataStreamRequests.java:
##########
@@ -91,18 +110,26 @@ void 
addToStreamingGetDataRequest(Windmill.StreamingGetDataRequest.Builder build
     }
   }
 
+  /** Represents a batch of queued requests. Methods are thread-safe unless 
commented otherwise. */
   static class QueuedBatch {
     private final List<QueuedRequest> requests = new ArrayList<>();
     private final CountDownLatch sent = new CountDownLatch(1);
     private long byteSize = 0;
-    private boolean finalized = false;
+    private volatile boolean finalized = false;
+    private volatile boolean failed = false;
 
-    CountDownLatch getLatch() {
-      return sent;
+    /**
+     * Returns a read-only view of requests sorted with {@link 
QueuedRequest#globalRequestsFirst()}.
+     */
+    List<QueuedRequest> sortedRequestsReadOnly() {
+      // Put all global data requests first because there is only a single 
repeated field for
+      // request ids and the initial ids correspond to global data requests if 
they are present.
+      requests.sort(QueuedRequest.globalRequestsFirst());
+      return Collections.unmodifiableList(requests);

Review Comment:
   moved request construction into the QueuedBatch class so we can just sort 
and construct the StreamingGetDataRequest together



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