Skip to content

Commit

Permalink
Only call calculateBrokerHostUsage once during LinuxBrokerHostUsageIm…
Browse files Browse the repository at this point in the history
…pl class initialization
  • Loading branch information
michaeljmarshall committed Feb 10, 2021
1 parent 6093b5c commit fffac55
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,17 @@ public LinuxBrokerHostUsageImpl(int hostUsageCheckIntervalMin,
this.lastCollection = 0L;
this.usage = new SystemResourceUsage();
this.overrideBrokerNicSpeedGbps = overrideBrokerNicSpeedGbps;
executorService.scheduleAtFixedRate(this::calculateBrokerHostUsage, 0,
hostUsageCheckIntervalMin, TimeUnit.MINUTES);

boolean isCGroupsEnabled = false;
try {
isCGroupsEnabled = Files.exists(Paths.get(CGROUPS_CPU_USAGE_PATH));
} catch (Exception e) {
log.warn("Failed to check cgroup CPU usage file: {}", e.getMessage());
}

this.isCGroupsEnabled = isCGroupsEnabled;
calculateBrokerHostUsage();

executorService.scheduleAtFixedRate(this::calculateBrokerHostUsage, 0,
hostUsageCheckIntervalMin, TimeUnit.MINUTES);
}

@Override
Expand Down

0 comments on commit fffac55

Please sign in to comment.