From 48bb56dea886250fb7499899e3500797abaa1985 Mon Sep 17 00:00:00 2001 From: Sami Siren Date: Thu, 23 Feb 2012 20:18:24 +0000 Subject: [PATCH] SOLR-3148: expose more system info git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1292938 13f79535-47bb-0310-9956-ffa450edef68 --- .../solr/handler/admin/SystemInfoHandler.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java index 8dc782424a8..93129e24c8e 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java @@ -124,20 +124,20 @@ public class SystemInfoHandler extends RequestHandlerBase info.add( "name", os.getName() ); info.add( "version", os.getVersion() ); info.add( "arch", os.getArch() ); + info.add( "systemLoadAverage", os.getSystemLoadAverage()); - // Java 1.6 - addGetterIfAvaliable( os, "systemLoadAverage", info ); + // com.sun.management.OperatingSystemMXBean + addGetterIfAvaliable( os, "committedVirtualMemorySize", info); + addGetterIfAvaliable( os, "freePhysicalMemorySize", info); + addGetterIfAvaliable( os, "freeSwapSpaceSize", info); + addGetterIfAvaliable( os, "processCpuTime", info); + addGetterIfAvaliable( os, "totalPhysicalMemorySize", info); + addGetterIfAvaliable( os, "totalSwapSpaceSize", info); // com.sun.management.UnixOperatingSystemMXBean addGetterIfAvaliable( os, "openFileDescriptorCount", info ); addGetterIfAvaliable( os, "maxFileDescriptorCount", info ); - // com.sun.management.OperatingSystemMXBean - addGetterIfAvaliable( os, "committedVirtualMemorySize", info ); - addGetterIfAvaliable( os, "totalPhysicalMemorySize", info ); - addGetterIfAvaliable( os, "totalSwapSpaceSize", info ); - addGetterIfAvaliable( os, "processCpuTime", info ); - try { if( !os.getName().toLowerCase(Locale.ENGLISH).startsWith( "windows" ) ) { // Try some command line things @@ -165,6 +165,7 @@ public class SystemInfoHandler extends RequestHandlerBase try { String n = Character.toUpperCase( getter.charAt(0) ) + getter.substring( 1 ); Method m = obj.getClass().getMethod( "get" + n ); + m.setAccessible(true); Object v = m.invoke( obj, (Object[])null ); if( v != null ) { info.add( getter, v );