Skip to content

Commit

Permalink
Remove redundant clone method
Browse files Browse the repository at this point in the history
The class is immutable.
  • Loading branch information
findepi committed Mar 26, 2024
1 parent 6f6c668 commit 9e29231
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ public Collection<InternalResourceGroup> subGroups()
ResourceUsage getResourceUsageSnapshot()
{
synchronized (root) {
return cachedResourceUsage.clone();
return cachedResourceUsage;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9e29231

Please sign in to comment.