Java Code Examples for java.lang.management.ManagementFactory#GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE
The following examples show how to use
java.lang.management.ManagementFactory#GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MXBeanInteropTest1.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private final int doGarbageCollectorMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- GarbageCollectorMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName garbageName = iter.next() ; System.out.println("-------- " + garbageName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(garbageName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); GarbageCollectorMXBean garbage = null ; garbage = JMX.newMXBeanProxy(mbsc, garbageName, GarbageCollectorMXBean.class) ; System.out.println("getCollectionCount\t\t" + garbage.getCollectionCount()); System.out.println("getCollectionTime\t\t" + garbage.getCollectionTime()); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 2
Source File: MXBeanInteropTest1.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private final int doGarbageCollectorMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- GarbageCollectorMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName garbageName = iter.next() ; System.out.println("-------- " + garbageName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(garbageName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); GarbageCollectorMXBean garbage = null ; garbage = JMX.newMXBeanProxy(mbsc, garbageName, GarbageCollectorMXBean.class) ; System.out.println("getCollectionCount\t\t" + garbage.getCollectionCount()); System.out.println("getCollectionTime\t\t" + garbage.getCollectionTime()); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 3
Source File: MXBeanInteropTest1.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private final int doGarbageCollectorMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- GarbageCollectorMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName garbageName = iter.next() ; System.out.println("-------- " + garbageName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(garbageName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); GarbageCollectorMXBean garbage = null ; garbage = JMX.newMXBeanProxy(mbsc, garbageName, GarbageCollectorMXBean.class) ; System.out.println("getCollectionCount\t\t" + garbage.getCollectionCount()); System.out.println("getCollectionTime\t\t" + garbage.getCollectionTime()); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 4
Source File: MXBeanInteropTest1.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private final int doGarbageCollectorMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- GarbageCollectorMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName garbageName = iter.next() ; System.out.println("-------- " + garbageName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(garbageName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); GarbageCollectorMXBean garbage = null ; garbage = JMX.newMXBeanProxy(mbsc, garbageName, GarbageCollectorMXBean.class) ; System.out.println("getCollectionCount\t\t" + garbage.getCollectionCount()); System.out.println("getCollectionTime\t\t" + garbage.getCollectionTime()); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 5
Source File: MXBeanInteropTest1.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private final int doGarbageCollectorMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- GarbageCollectorMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName garbageName = iter.next() ; System.out.println("-------- " + garbageName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(garbageName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); GarbageCollectorMXBean garbage = null ; garbage = JMX.newMXBeanProxy(mbsc, garbageName, GarbageCollectorMXBean.class) ; System.out.println("getCollectionCount\t\t" + garbage.getCollectionCount()); System.out.println("getCollectionTime\t\t" + garbage.getCollectionTime()); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 6
Source File: MXBeanInteropTest1.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private final int doGarbageCollectorMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- GarbageCollectorMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName garbageName = iter.next() ; System.out.println("-------- " + garbageName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(garbageName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); GarbageCollectorMXBean garbage = null ; garbage = JMX.newMXBeanProxy(mbsc, garbageName, GarbageCollectorMXBean.class) ; System.out.println("getCollectionCount\t\t" + garbage.getCollectionCount()); System.out.println("getCollectionTime\t\t" + garbage.getCollectionTime()); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 7
Source File: MXBeanInteropTest1.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private final int doGarbageCollectorMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- GarbageCollectorMXBean") ; try { ObjectName filterName = new ObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",*"); Set<ObjectName> onSet = mbsc.queryNames(filterName, null); for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) { ObjectName garbageName = iter.next() ; System.out.println("-------- " + garbageName) ; MBeanInfo mbInfo = mbsc.getMBeanInfo(garbageName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); GarbageCollectorMXBean garbage = null ; garbage = JMX.newMXBeanProxy(mbsc, garbageName, GarbageCollectorMXBean.class) ; System.out.println("getCollectionCount\t\t" + garbage.getCollectionCount()); System.out.println("getCollectionTime\t\t" + garbage.getCollectionTime()); } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 8
Source File: GCInspector.java From stratio-cassandra with Apache License 2.0 | 5 votes |
public static void register() throws Exception { GCInspector inspector = new GCInspector(); MBeanServer server = ManagementFactory.getPlatformMBeanServer(); ObjectName gcName = new ObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",*"); for (ObjectName name : server.queryNames(gcName, null)) { server.addNotificationListener(name, inspector, null, null); } }
Example 9
Source File: GCDataProvider.java From perfmon-agent with Apache License 2.0 | 4 votes |
protected String getMXBeanType() { return ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE; }