[jboss-cvs] JBossAS SVN: r112563 - branches/JBPAPP_5_1/system-jmx/src/main/org/jboss/system/server/jmx.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 9 01:33:57 EST 2012


Author: jiwils
Date: 2012-01-09 01:33:56 -0500 (Mon, 09 Jan 2012)
New Revision: 112563

Modified:
   branches/JBPAPP_5_1/system-jmx/src/main/org/jboss/system/server/jmx/
   branches/JBPAPP_5_1/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java
Log:
Merging 5.1.3_interim changes: [JBPAPP-7295] Fleshed out JMXKernel.java to make proper java.lang.Runtime calls in runFinalization(), runGarbageCollector(), traceInstruction(), and traceMethodCalls().


Property changes on: branches/JBPAPP_5_1/system-jmx/src/main/org/jboss/system/server/jmx
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/JBPAPP_5_1_3_interim/system-jmx/src/main/org/jboss/system/server/jmx:112482

Modified: branches/JBPAPP_5_1/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java
===================================================================
--- branches/JBPAPP_5_1/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java	2012-01-09 06:30:28 UTC (rev 112562)
+++ branches/JBPAPP_5_1/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java	2012-01-09 06:33:56 UTC (rev 112563)
@@ -369,24 +369,56 @@
       return serverImpl.isStarted();
    }
 
+   /**
+    * Hint to the JVM to run any pending object finailizations.
+    *
+    * @jmx:managed-operation
+    */
    public void runFinalization()
    {
-      
+      Runtime.getRuntime().runFinalization();
+      log.info("Hinted to the JVM to run any pending object finalizations");
    }
 
+   /** A simple helper used to log the Runtime memory information. */
+   private void logMemoryUsage(final Runtime rt)
+   {
+      log.info("Total/free memory: " + rt.totalMemory() + "/" + rt.freeMemory());
+   }
+
+   /**
+    * Hint to the JVM to run the garbage collector.
+    *
+    * @jmx:managed-operation
+    */
    public void runGarbageCollector()
    {
-      
+      Runtime rt = Runtime.getRuntime();
+
+      logMemoryUsage(rt);
+      rt.gc();
+      log.info("Hinted to the JVM to run garbage collection");
+      logMemoryUsage(rt);
    }
 
+   /**
+    * Enable or disable tracing instructions the Runtime level.
+    *
+    * @jmx:managed-operation
+    */
    public void traceInstructions(Boolean flag)
    {
-      
+      Runtime.getRuntime().traceInstructions(flag.booleanValue());
    }
 
+   /**
+    * Enable or disable tracing method calls at the Runtime level.
+    *
+    * @jmx:managed-operation
+    */
    public void traceMethodCalls(Boolean flag)
    {
-      
+      Runtime.getRuntime().traceMethodCalls(flag.booleanValue());
    }
    
    public void shutdown()



More information about the jboss-cvs-commits mailing list