SOLR-3970: SystemInfoHandler now exposes more details about the JRE/VM/Java version in use

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1411495 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2012-11-20 01:13:12 +00:00
parent 9ad99fc073
commit f0ee717c65
2 changed files with 33 additions and 2 deletions

View File

@ -73,6 +73,9 @@ New Features
* SOLR-4088: New and improved auto host detection strategy for SolrCloud.
(Raintung Li via Mark Miller)
* SOLR-3970: SystemInfoHandler now exposes more details about the
JRE/VM/Java version in use. (hossman)
Optimizations
----------------------

View File

@ -211,8 +211,36 @@ public class SystemInfoHandler extends RequestHandlerBase
public static SimpleOrderedMap<Object> getJvmInfo()
{
SimpleOrderedMap<Object> jvm = new SimpleOrderedMap<Object>();
jvm.add( "version", System.getProperty("java.vm.version") );
jvm.add( "name", System.getProperty("java.vm.name") );
final String javaVersion = System.getProperty("java.specification.version", "unknown");
final String javaVendor = System.getProperty("java.specification.vendor", "unknown");
final String javaName = System.getProperty("java.specification.name", "unknown");
final String jreVersion = System.getProperty("java.version", "unknown");
final String jreVendor = System.getProperty("java.vendor", "unknown");
final String vmVersion = System.getProperty("java.vm.version", "unknown");
final String vmVendor = System.getProperty("java.vm.vendor", "unknown");
final String vmName = System.getProperty("java.vm.name", "unknown");
// Summary Info
jvm.add( "version", jreVersion + " " + vmVersion);
jvm.add( "name", jreVendor + " " + vmName );
// details
SimpleOrderedMap<Object> java = new SimpleOrderedMap<Object>();
java.add( "vendor", javaVendor );
java.add( "name", javaName );
java.add( "version", javaVersion );
jvm.add( "spec", java );
SimpleOrderedMap<Object> jre = new SimpleOrderedMap<Object>();
jre.add( "vendor", jreVendor );
jre.add( "version", jreVersion );
jvm.add( "jre", jre );
SimpleOrderedMap<Object> vm = new SimpleOrderedMap<Object>();
vm.add( "vendor", vmVendor );
vm.add( "name", vmName );
vm.add( "version", vmVersion );
jvm.add( "vm", vm );
Runtime runtime = Runtime.getRuntime();
jvm.add( "processors", runtime.availableProcessors() );