diff --git a/core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java b/core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java index 81198805c32c..6fcc6c6616db 100644 --- a/core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java +++ b/core/trino-main/src/main/java/io/trino/execution/resourcegroups/InternalResourceGroup.java @@ -954,7 +954,7 @@ public Collection subGroups() ResourceUsage getResourceUsageSnapshot() { synchronized (root) { - return cachedResourceUsage.clone(); + return cachedResourceUsage; } } diff --git a/core/trino-main/src/main/java/io/trino/execution/resourcegroups/ResourceUsage.java b/core/trino-main/src/main/java/io/trino/execution/resourcegroups/ResourceUsage.java index bb9c13f56298..98fc16d26b10 100644 --- a/core/trino-main/src/main/java/io/trino/execution/resourcegroups/ResourceUsage.java +++ b/core/trino-main/src/main/java/io/trino/execution/resourcegroups/ResourceUsage.java @@ -21,7 +21,7 @@ import static com.google.common.math.LongMath.saturatedSubtract; @Immutable -class ResourceUsage +final class ResourceUsage { private final long cpuUsageMillis; private final long memoryUsageBytes; @@ -32,12 +32,6 @@ public ResourceUsage(long cpuUsageMillis, long memoryUsageBytes) this.memoryUsageBytes = memoryUsageBytes; } - @Override - public ResourceUsage clone() - { - return new ResourceUsage(cpuUsageMillis, memoryUsageBytes); - } - public ResourceUsage add(ResourceUsage other) { long newCpuUsageMillis = saturatedAdd(this.cpuUsageMillis, other.cpuUsageMillis);