I would like to know what is the différence between using ManagementFactory.getPlatformMBeanServer() and
MBeanServerFactory.createMBeanServer to create an mbeanServer
Edited by: riadhhwajdii on Apr 14, 2010 4:29 AM
Edited by: riadhhwajdii on Apr 14, 2010 4:45 AM
both methods return an instance of an MBeanServer to work with. The difference is that the "ManagementFactory.getPlatformMBeanServer()" constructs an MBeanServer internally(by calling MBeanServerFactory.createMBeanServer)
and registers [platform's MXBeans|http://java.sun.com/javase/6/docs/api/java/lang/management/ManagementFactory.html#MXBean] a set of MBeans that provide useful metrics/info of the java runtime (eg. free memory, garbage collection info, etc).
Have a look at the documentation of the method
Hope that helps