bvolpato commented on code in PR #27195:
URL: https://github.com/apache/beam/pull/27195#discussion_r1264054141
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/BoundedQueueExecutor.java:
##########
@@ -51,7 +55,31 @@ public BoundedQueueExecutor(
keepAliveTime,
unit,
new LinkedBlockingQueue<>(),
- threadFactory);
+ threadFactory) {
+ @Override
+ protected void beforeExecute(Thread t, Runnable r) {
+ super.beforeExecute(t, r);
+ synchronized (this) {
+ if (activeCount.get() == maximumPoolSize - 1) {
+ startTimeMaxActiveThreadsUsed = System.currentTimeMillis();
+ }
+ activeCount.incrementAndGet();
Review Comment:
We could make it "more" atomic
```suggestion
if (activeCount.getAndIncrement() == maximumPoolSize - 1) {
startTimeMaxActiveThreadsUsed = System.currentTimeMillis();
}
```
--
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]