m-trieu commented on code in PR #30322:
URL: https://github.com/apache/beam/pull/30322#discussion_r1491651479
##########
runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/windmill/client/grpc/StreamingEngineClientTest.java:
##########
@@ -412,10 +428,22 @@ private void close() {
}
private static class TestGetWorkBudgetDistributor implements
GetWorkBudgetDistributor {
+ private final CountDownLatch getWorkBudgetDistributorTriggered;
+
+ private TestGetWorkBudgetDistributor(int numBudgetDistributionsExpected) {
+ this.getWorkBudgetDistributorTriggered = new
CountDownLatch(numBudgetDistributionsExpected);
+ }
+
+ @SuppressWarnings("ReturnValueIgnored")
+ private void waitForBudgetDistribution() throws InterruptedException {
+ getWorkBudgetDistributorTriggered.await(5, TimeUnit.SECONDS);
+ }
+
@Override
public void distributeBudget(
ImmutableCollection<WindmillStreamSender> streams, GetWorkBudget
getWorkBudget) {
streams.forEach(stream -> stream.adjustBudget(getWorkBudget.items(),
getWorkBudget.bytes()));
+ getWorkBudgetDistributorTriggered.countDown();
Review Comment:
it doesn't
from javadoc:
```
countDown
public void countDown()
Decrements the count of the latch, releasing all waiting threads if the
count reaches zero.
If the current count is greater than zero then it is decremented. If the new
count is zero then all waiting threads are re-enabled for thread scheduling
purposes.
If the current count equals zero then nothing happens.
```
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CountDownLatch.html#countDown--
--
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]