MelodyShen commented on code in PR #30439:
URL: https://github.com/apache/beam/pull/30439#discussion_r1525267452
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/BoundedQueueExecutor.java:
##########
@@ -115,12 +143,16 @@ public boolean executorQueueIsEmpty() {
return executor.getQueue().isEmpty();
}
- public long allThreadsActiveTime() {
+ public synchronized long allThreadsActiveTime() {
return totalTimeMaxActiveThreadsUsed;
}
- public int activeCount() {
- return activeCount.intValue();
+ public synchronized int activeCount() {
+ return activeCount;
+ }
+
+ public synchronized int maximumThreadCount() {
+ return maximumThreadCount;
}
public long bytesOutstanding() {
Review Comment:
Yeah they are not thread safe. They are currently used in
StreamingDataflowWorker to gather metrics so it seems okay to me to leave them
unsafe but in case we use them for other purposes, I feel it is better to be
changed to use monitor.
--
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]