arne-alex commented on code in PR #23333:
URL: https://github.com/apache/beam/pull/23333#discussion_r1004976098
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java:
##########
@@ -832,21 +845,22 @@ public void start() {
ExecutionStateSampler.instance().start();
// Periodically report workers counters and other updates.
- globalWorkerUpdatesTimer = new Timer("GlobalWorkerUpdatesTimer");
- globalWorkerUpdatesTimer.schedule(
- new TimerTask() {
+ globalWorkerUpdatesTimer = executorSupplier.get();
+ globalWorkerUpdatesTimer.scheduleWithFixedDelay(
+ new Runnable() {
@Override
public void run() {
reportPeriodicWorkerUpdates();
}
},
0,
- options.getWindmillHarnessUpdateReportingPeriod().getMillis());
+ options.getWindmillHarnessUpdateReportingPeriod().getMillis(),
+ TimeUnit.MILLISECONDS);
- refreshWorkTimer = new Timer("RefreshWork");
+ refreshWorkTimer = executorSupplier.get();
Review Comment:
Done via passing a ThreadFactory to newSingleThreadScheduledExecutor. In
this case, the ThreadFactory comes from Guava ThreadFactoryBuilder, which is a
tiny bit simpler than implementing the ThreadFactory interface.
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java:
##########
@@ -832,21 +845,22 @@ public void start() {
ExecutionStateSampler.instance().start();
// Periodically report workers counters and other updates.
- globalWorkerUpdatesTimer = new Timer("GlobalWorkerUpdatesTimer");
- globalWorkerUpdatesTimer.schedule(
- new TimerTask() {
+ globalWorkerUpdatesTimer = executorSupplier.get();
+ globalWorkerUpdatesTimer.scheduleWithFixedDelay(
+ new Runnable() {
Review Comment:
Done
--
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]