org.jboss.system.server
Class ServerInfo

java.lang.Object
  extended byorg.jboss.system.server.ServerInfo
All Implemented Interfaces:
MBeanRegistration (src)

public class ServerInfo
extends java.lang.Object
implements MBeanRegistration (src)

An MBean that provides a rich view of system information for the JBoss server in which it is deployed.


Field Summary
static ObjectName (src) DEFAULT_LOADER_REPOSITORY
           
 
Constructor Summary
ServerInfo()
           
 
Method Summary
 java.lang.String displayAllPackageInfo()
          This does not work as expected because the thread context class loader is not used to determine which class loader the package list is obtained from.
 java.lang.String displayInfoForClass(java.lang.String className)
          Display the ClassLoader, ProtectionDomain and Package information for the specified class.
 java.lang.String displayPackageInfo(java.lang.String pkgName)
          Display the java.lang.Package info for the pkgName
 java.lang.Integer getActiveThreadCount()
           
 java.lang.Integer getActiveThreadGroupCount()
           
 java.lang.Integer getAvailableProcessors()
          Returns Runtime.getRuntime().availableProcessors() on JDK 1.4 vms or -1 on previous versions.
 java.lang.Long getFreeMemory()
           
 java.lang.String getHostAddress()
          Returns InetAddress.getLocalHost().getHostAddress();
 java.lang.String getHostName()
          Returns InetAddress.getLocalHost().getHostName();
 java.lang.String getJavaVendor()
           
 java.lang.String getJavaVersion()
           
 java.lang.String getJavaVMName()
           
 java.lang.String getJavaVMVendor()
           
 java.lang.String getJavaVMVersion()
           
 java.lang.Long getMaxMemory()
          Returns Runtime.getRuntime().maxMemory() on JDK 1.4 vms or -1 on previous versions.
 java.lang.String getOSArch()
           
 java.lang.String getOSName()
           
 java.lang.String getOSVersion()
           
 java.lang.Long getTotalMemory()
           
 java.lang.String listMemoryPools(boolean fancy)
          Return a listing of the thread pools on jdk5+.
 java.lang.String listThreadDump()
          Return a listing of the active threads and thread groups.
 void postDeregister()
          This method is called by the MBeanServer after deregistration takes place.
 void postRegister(java.lang.Boolean registrationDone)
          This method is called by the MBeanServer after registration takes place or when registration fails.
 void preDeregister()
          This method is called by the MBeanServer before deregistration takes place.
 ObjectName (src) preRegister(MBeanServer (src)  server, ObjectName (src)  name)
          This method is called by the MBeanServer before registration takes place.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LOADER_REPOSITORY

public static final ObjectName (src)  DEFAULT_LOADER_REPOSITORY
Constructor Detail

ServerInfo

public ServerInfo()
Method Detail

preRegister

public ObjectName (src)  preRegister(MBeanServer (src)  server,
                              ObjectName (src)  name)
                       throws java.lang.Exception
Description copied from interface: MBeanRegistration (src)
This method is called by the MBeanServer before registration takes place. The MBean is passed a reference of the MBeanServer it is about to be registered with. The MBean must return the ObjectName it will be registered with. The MBeanServer can pass a suggested object depending upon how the MBean is registered.

The MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

Specified by:
preRegister in interface MBeanRegistration (src)
Returns:
the actual ObjectName to register this MBean with.
Throws:
java.lang.Exception - for any error, the MBean is not registered.

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Description copied from interface: MBeanRegistration (src)
This method is called by the MBeanServer after registration takes place or when registration fails.

Specified by:
postRegister in interface MBeanRegistration (src)
Parameters:
registrationDone - the MBeanServer passes true when the MBean was registered, false otherwise.

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Description copied from interface: MBeanRegistration (src)
This method is called by the MBeanServer before deregistration takes place.

The MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

Specified by:
preDeregister in interface MBeanRegistration (src)
Throws:
java.lang.Exception

postDeregister

public void postDeregister()
Description copied from interface: MBeanRegistration (src)
This method is called by the MBeanServer after deregistration takes place.

Specified by:
postDeregister in interface MBeanRegistration (src)

getJavaVersion

public java.lang.String getJavaVersion()

getJavaVendor

public java.lang.String getJavaVendor()

getJavaVMName

public java.lang.String getJavaVMName()

getJavaVMVersion

public java.lang.String getJavaVMVersion()

getJavaVMVendor

public java.lang.String getJavaVMVendor()

getOSName

public java.lang.String getOSName()

getOSVersion

public java.lang.String getOSVersion()

getOSArch

public java.lang.String getOSArch()

getTotalMemory

public java.lang.Long getTotalMemory()

getFreeMemory

public java.lang.Long getFreeMemory()

getMaxMemory

public java.lang.Long getMaxMemory()
Returns Runtime.getRuntime().maxMemory() on JDK 1.4 vms or -1 on previous versions.


getAvailableProcessors

public java.lang.Integer getAvailableProcessors()
Returns Runtime.getRuntime().availableProcessors() on JDK 1.4 vms or -1 on previous versions.


getHostName

public java.lang.String getHostName()
Returns InetAddress.getLocalHost().getHostName();


getHostAddress

public java.lang.String getHostAddress()
Returns InetAddress.getLocalHost().getHostAddress();


listMemoryPools

public java.lang.String listMemoryPools(boolean fancy)
Return a listing of the thread pools on jdk5+.

Parameters:
fancy - produce a text-based graph when true

getActiveThreadCount

public java.lang.Integer getActiveThreadCount()

getActiveThreadGroupCount

public java.lang.Integer getActiveThreadGroupCount()

listThreadDump

public java.lang.String listThreadDump()
Return a listing of the active threads and thread groups.


displayPackageInfo

public java.lang.String displayPackageInfo(java.lang.String pkgName)
Display the java.lang.Package info for the pkgName


displayInfoForClass

public java.lang.String displayInfoForClass(java.lang.String className)
                                     throws java.lang.Exception
Display the ClassLoader, ProtectionDomain and Package information for the specified class.

Returns:
a simple html report of this information
Throws:
java.lang.Exception

displayAllPackageInfo

public java.lang.String displayAllPackageInfo()
This does not work as expected because the thread context class loader is not used to determine which class loader the package list is obtained from.