NodeUsageCollector migrate from using finalize() to Cleaner

This commit is contained in:
Rob Bygrave committed 2022-04-21 08:40:00 +12:00
1 parent 4d21fbfcf8
commit e1b9bf62a3
7 files changed
+143 -104

No files matched your search

@@ -91,8 +91,8 @@ public class ProfileManager implements ProfilingListener {
* is called on the bean.
*/
@Override
public void collectNodeUsage(NodeUsageCollector usageCollector) {
ProfileOrigin profileOrigin = getProfileOrigin(usageCollector.getNode().getOriginQueryPoint());
public void collectNodeUsage(NodeUsageCollector.State usageCollector) {
ProfileOrigin profileOrigin = getProfileOrigin(usageCollector.node().getOriginQueryPoint());
profileOrigin.collectUsageInfo(usageCollector);
}
@@ -151,9 +151,9 @@ public class ProfileOrigin {
/**
* Collect the usage information for from a instance for this node.
*/
public void collectUsageInfo(NodeUsageCollector profile) {
public void collectUsageInfo(NodeUsageCollector.State profile) {
if (!profile.isEmpty()) {
getNodeStats(profile.getNode().getPath()).collectUsageInfo(profile);
getNodeStats(profile.node().getPath()).collectUsageInfo(profile);
}
}
@@ -103,11 +103,10 @@ public class ProfileOriginNodeUsage {
/**
* Collect usage from a node.
*/
protected void collectUsageInfo(NodeUsageCollector profile) {
protected void collectUsageInfo(NodeUsageCollector.State profile) {
lock.lock();
try {
Set<String> used = profile.getUsed();
Set<String> used = profile.used();
profileCount++;
if (!used.isEmpty()) {
profileUsedCount++;