Skip to content

Commit

Permalink
make add collector method synchronized
Browse files Browse the repository at this point in the history
Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
  • Loading branch information
eirsep committed Apr 4, 2022
1 parent 4c89d09 commit 7883f30
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,11 @@ public synchronized boolean getEnabled() {
}

public synchronized void setThreadContentionMonitoringEnabled(final boolean enabled) {
LOG.error("debugTcm: setting tcm in executor as {}", enabled);

for (PerformanceAnalyzerMetricsCollector collector : metricsCollectors.keySet()) {
LOG.error(
"debugTcm: invoking setTcm in {} as {}", collector.getCollectorName(), enabled);
collector.setThreadContentionMonitoringEnabled(enabled);
}
metricsCollectors.keySet().forEach(collector -> collector.setThreadContentionMonitoringEnabled(enabled));
threadContentionMonitoringEnabled = enabled;
}

public void addScheduledMetricCollector(PerformanceAnalyzerMetricsCollector task) {
public synchronized void addScheduledMetricCollector(PerformanceAnalyzerMetricsCollector task) {
task.setThreadContentionMonitoringEnabled(threadContentionMonitoringEnabled);
metricsCollectors.put(task, System.currentTimeMillis() + task.getTimeInterval());
if (task.getTimeInterval() < minTimeIntervalToSleep) {
Expand Down

0 comments on commit 7883f30

Please sign in to comment.