use of com.google.gerrit.server.config.ConfigResource in project gerrit by GerritCodeReview.
the class ShowCaches method getCaches.
private Collection<CacheInfo> getCaches() {
@SuppressWarnings("unchecked") Map<String, CacheInfo> caches = (Map<String, CacheInfo>) listCaches.apply(new ConfigResource());
for (Map.Entry<String, CacheInfo> entry : caches.entrySet()) {
CacheInfo cache = entry.getValue();
cache.name = entry.getKey();
}
return caches.values();
}
use of com.google.gerrit.server.config.ConfigResource in project gerrit by GerritCodeReview.
the class ShowCaches method run.
@Override
protected void run() throws UnloggedFailure {
nw = columns - 50;
Date now = new Date();
stdout.format("%-25s %-20s now %16s\n", "Gerrit Code Review", Version.getVersion() != null ? Version.getVersion() : "", new SimpleDateFormat("HH:mm:ss zzz").format(now));
stdout.format("%-25s %-20s uptime %16s\n", "", "", uptime(now.getTime() - serverStarted));
stdout.print('\n');
stdout.print(//
String.format(//
"%1s %-" + nw + "s|%-21s| %-5s |%-9s|\n", //
"", //
"Name", //
"Entries", //
"AvgGet", //
"Hit Ratio"));
stdout.print(//
String.format(//
"%1s %-" + nw + "s|%6s %6s %7s| %-5s |%-4s %-4s|\n", //
"", //
"", //
"Mem", //
"Disk", //
"Space", //
"", //
"Mem", //
"Disk"));
stdout.print("--");
for (int i = 0; i < nw; i++) {
stdout.print('-');
}
stdout.print("+---------------------+---------+---------+\n");
Collection<CacheInfo> caches = getCaches();
printMemoryCoreCaches(caches);
printMemoryPluginCaches(caches);
printDiskCaches(caches);
stdout.print('\n');
boolean showJvm;
try {
permissionBackend.user(self).check(GlobalPermission.MAINTAIN_SERVER);
showJvm = true;
} catch (AuthException | PermissionBackendException e) {
// Silently ignore and do not display detailed JVM information.
showJvm = false;
}
if (showJvm) {
sshSummary();
SummaryInfo summary = getSummary.setGc(gc).setJvm(showJVM).apply(new ConfigResource());
taskSummary(summary.taskSummary);
memSummary(summary.memSummary);
threadSummary(summary.threadSummary);
if (showJVM && summary.jvmSummary != null) {
jvmSummary(summary.jvmSummary);
}
}
stdout.flush();
}
use of com.google.gerrit.server.config.ConfigResource in project gerrit by GerritCodeReview.
the class KillCommand method run.
@Override
protected void run() {
ConfigResource cfgRsrc = new ConfigResource();
for (String id : taskIds) {
try {
TaskResource taskRsrc = tasksCollection.parse(cfgRsrc, IdString.fromDecoded(id));
deleteTask.apply(taskRsrc, null);
} catch (AuthException | ResourceNotFoundException | PermissionBackendException e) {
stderr.print("kill: " + id + ": No such task\n");
}
}
}
Aggregations