1 5 package org.exoplatform.container.monitor.jvm.v15; 6 7 8 import java.lang.management.* ; 9 import java.net.URL ; 10 import org.exoplatform.container.monitor.jvm.OperatingSystemInfo; 11 16 public class OperatingSystemInfoImpl implements OperatingSystemInfo { 17 private OperatingSystemMXBean mxbean_ ; 18 19 public OperatingSystemInfoImpl() { 20 mxbean_ = ManagementFactory.getOperatingSystemMXBean(); 21 } 22 23 public String getArch() { return mxbean_.getArch() ; } 24 25 public String getName() { return mxbean_.getName() ; } 26 27 public String getVersion() { return mxbean_.getVersion() ;} 28 29 public int getAvailableProcessors() { return mxbean_.getAvailableProcessors() ; } 30 31 public URL createURL(String file) throws Exception { 32 return new URL ("file:" + file) ; 33 } 34 35 public String toString() { 36 StringBuilder b = new StringBuilder () ; 37 b.append("Operating System: ").append(getName()).append("\n") ; 38 b.append("Operating System Version : ").append(getVersion()).append("\n") ; 39 b.append("CPU Achitechure : ").append(getArch()).append("\n") ; 40 b.append("Number of Processors : ").append(getAvailableProcessors()).append("\n") ; 41 return b.toString() ; 42 } 43 } | Popular Tags |