[jboss-cvs] JBossAS SVN: r112482 - branches/JBPAPP_5_1_3_interim/system-jmx/src/main/org/jboss/system/server/jmx.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 29 11:57:23 EST 2011
Author: aogburn
Date: 2011-11-29 11:57:23 -0500 (Tue, 29 Nov 2011)
New Revision: 112482
Modified:
branches/JBPAPP_5_1_3_interim/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java
Log:
[JBPAPP-7295] Fleshed out JMXKernel.java to make proper java.lang.Runtime calls in runFinalization(), runGarbageCollector(), traceInstruction(), and traceMethodCalls().
Modified: branches/JBPAPP_5_1_3_interim/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java
===================================================================
--- branches/JBPAPP_5_1_3_interim/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java 2011-11-29 15:01:11 UTC (rev 112481)
+++ branches/JBPAPP_5_1_3_interim/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java 2011-11-29 16:57:23 UTC (rev 112482)
@@ -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