Use WindowCacheStats from JGit
Since [1] JGit exposes a public class WindowCacheStats, allowing to access the statistics from WindowCache which is not a public API. Remove the WindowCacheStatAccessor and use the new API instead. [1] https://git.eclipse.org/r/#/c/116501/ Change-Id: I73dff00c309efd37030c02af91e7e7643b9b3751
This commit is contained in:
@@ -18,7 +18,7 @@ import com.google.common.base.Supplier;
|
||||
import com.google.gerrit.metrics.Description;
|
||||
import com.google.gerrit.metrics.Description.Units;
|
||||
import com.google.gerrit.metrics.MetricMaker;
|
||||
import org.eclipse.jgit.internal.storage.file.WindowCacheStatAccessor;
|
||||
import org.eclipse.jgit.storage.file.WindowCacheStats;
|
||||
|
||||
public class JGitMetricModule extends MetricModule {
|
||||
@Override
|
||||
@@ -32,7 +32,7 @@ public class JGitMetricModule extends MetricModule {
|
||||
new Supplier<Long>() {
|
||||
@Override
|
||||
public Long get() {
|
||||
return WindowCacheStatAccessor.getOpenBytes();
|
||||
return WindowCacheStats.getOpenBytes();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ public class JGitMetricModule extends MetricModule {
|
||||
new Supplier<Integer>() {
|
||||
@Override
|
||||
public Integer get() {
|
||||
return WindowCacheStatAccessor.getOpenFiles();
|
||||
return WindowCacheStats.getOpenFiles();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.eclipse.jgit.internal.storage.file.WindowCacheStatAccessor;
|
||||
import org.eclipse.jgit.storage.file.WindowCacheStats;
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
@RequiresCapability(GlobalCapability.MAINTAIN_SERVER)
|
||||
@@ -125,8 +125,8 @@ public class GetSummary implements RestReadView<ConfigResource> {
|
||||
long mTotal = r.totalMemory();
|
||||
long mInuse = mTotal - mFree;
|
||||
|
||||
int jgitOpen = WindowCacheStatAccessor.getOpenFiles();
|
||||
long jgitBytes = WindowCacheStatAccessor.getOpenBytes();
|
||||
int jgitOpen = WindowCacheStats.getOpenFiles();
|
||||
long jgitBytes = WindowCacheStats.getOpenBytes();
|
||||
|
||||
MemSummaryInfo memSummaryInfo = new MemSummaryInfo();
|
||||
memSummaryInfo.total = bytes(mTotal);
|
||||
|
||||
@@ -39,7 +39,6 @@ java_library(
|
||||
srcs = [
|
||||
"diff/EditDeserializer.java",
|
||||
"diff/ReplaceEdit.java",
|
||||
"internal/storage/file/WindowCacheStatAccessor.java",
|
||||
"lib/ObjectIdSerialization.java",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
// Copyright (C) 2009 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package org.eclipse.jgit.internal.storage.file;
|
||||
|
||||
// Hack to obtain visibility to package level methods only.
|
||||
// These aren't yet part of the public JGit API.
|
||||
|
||||
public class WindowCacheStatAccessor {
|
||||
public static int getOpenFiles() {
|
||||
return WindowCache.getInstance().getOpenFiles();
|
||||
}
|
||||
|
||||
public static long getOpenBytes() {
|
||||
return WindowCache.getInstance().getOpenBytes();
|
||||
}
|
||||
|
||||
private WindowCacheStatAccessor() {}
|
||||
}
|
||||
Reference in New Issue
Block a user