Author: noel
Date: Wed Aug 30 20:09:52 2006
New Revision: 438755
URL: http://svn.apache.org/viewvc?rev=438755&view=rev
Log:
Add MEMSTAT [-gc] command to RemoteManager
Modified:
james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
Modified:
james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java?rev=438755&r1=438754&r2=438755&view=diff
==============================================================================
---
james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
(original)
+++
james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
Wed Aug 30 20:09:52 2006
@@ -58,6 +58,11 @@
extends AbstractJamesHandler {
/**
+ * The text string for the MEMSTAT command
+ */
+ private static final String COMMAND_MEMSTAT = "MEMSTAT";
+
+ /**
* The text string for the ADDUSER command
*/
private static final String COMMAND_ADDUSER = "ADDUSER";
@@ -349,6 +354,29 @@
return true;
}
+ /**
+ * Handler method called upon receipt of an MEMSTAT command.
+ * Returns whether further commands should be read off the wire.
+ *
+ * @param argument the argument passed in with the command
+ */
+ private boolean doMEMSTAT(String argument) {
+ writeLoggedFlushedResponse("Current memory statistics:");
+ writeLoggedFlushedResponse("\tFree Memory: " +
Runtime.getRuntime().freeMemory());
+ writeLoggedFlushedResponse("\tTotal Memory: " +
Runtime.getRuntime().totalMemory());
+ writeLoggedFlushedResponse("\tMax Memory: " +
Runtime.getRuntime().maxMemory());
+
+ if ("-gc".equalsIgnoreCase(argument)) {
+ System.gc();
+ writeLoggedFlushedResponse("And after System.gc():");
+ writeLoggedFlushedResponse("\tFree Memory: " +
Runtime.getRuntime().freeMemory());
+ writeLoggedFlushedResponse("\tTotal Memory: " +
Runtime.getRuntime().totalMemory());
+ writeLoggedFlushedResponse("\tMax Memory: " +
Runtime.getRuntime().maxMemory());
+ }
+
+ return true;
+ }
+
/**
* Handler method called upon receipt of an ADDUSER command.
* Returns whether further commands should be read off the wire.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]