bvolpato commented on code in PR #27195:
URL: https://github.com/apache/beam/pull/27195#discussion_r1264056587
##########
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();
+ }
+ }
+
+ @Override
+ protected void afterExecute(Runnable r, Throwable t) {
+ super.afterExecute(r, t);
+ synchronized (this) {
+ if (activeCount.get() == maximumPoolSize) {
Review Comment:
nit Same idea, getAndDecrement()... I guess you'd just need the synchronized
block on the long
--
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]