mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-10482: add timestamp to JMX dumps.
I had fixed this in the command line tool, but didn't realise that there was a Share-based interface too. Moved the fix to the common utils class. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31691 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -21,7 +21,10 @@ package org.alfresco.repo.management;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Array;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
@@ -34,6 +37,7 @@ import javax.management.MBeanServerConnection;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.openmbean.CompositeData;
|
||||
|
||||
|
||||
/**
|
||||
* A utility class providing a method to dump a local or remote MBeanServer's entire object tree for support purposes.
|
||||
* Nested arrays and CompositeData objects in MBean attribute values are handled.
|
||||
@@ -67,6 +71,8 @@ public class JmxDumpUtil
|
||||
*/
|
||||
public static void dumpConnection(MBeanServerConnection connection, PrintWriter out) throws IOException
|
||||
{
|
||||
JmxDumpUtil.showStartBanner(out);
|
||||
|
||||
// Get all the object names
|
||||
Set<ObjectName> objectNames = connection.queryNames(null, null);
|
||||
|
||||
@@ -81,6 +87,7 @@ public class JmxDumpUtil
|
||||
newObjectNames.addAll(objectNames);
|
||||
objectNames = newObjectNames;
|
||||
|
||||
|
||||
// Dump each MBean
|
||||
for (ObjectName objectName : objectNames)
|
||||
{
|
||||
@@ -351,4 +358,14 @@ public class JmxDumpUtil
|
||||
return value.toString().length();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a message stating the JmxDumper has been started, with the current date and time.
|
||||
*/
|
||||
private static void showStartBanner(PrintWriter out)
|
||||
{
|
||||
DateFormat df = SimpleDateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
|
||||
out.println(JmxDumpUtil.class.getSimpleName() + " started: " + df.format(new Date()));
|
||||
out.println();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user