Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant clone method #21255

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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;
Expand All @@ -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