Java Code Examples for javax.management.MBeanServerConnection#isRegistered()
The following examples show how to use
javax.management.MBeanServerConnection#isRegistered() .
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: AMXGlassfish.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** Ensure that AMX is loaded and ready to use. This method returns only when all AMX subsystems have been loaded. It can be called more than once without ill effect, subsequent calls are ignored. @param conn connection to the MBeanServer @return the ObjectName of the domain-root MBean */ public ObjectName bootAMX(final MBeanServerConnection conn) throws IOException { final ObjectName domainRoot = domainRoot(); if ( !conn.isRegistered( domainRoot ) ) { // wait for the BootAMXMBean to be available (loads at startup) final BootAMXCallback callback = new BootAMXCallback(conn); listenForBootAMX(conn, callback); callback.await(); // block until the MBean appears invokeBootAMX(conn); final WaitForDomainRootListenerCallback drCallback = new WaitForDomainRootListenerCallback(conn); listenForDomainRoot(conn, drCallback); drCallback.await(); invokeWaitAMXReady(conn, domainRoot); } else { invokeWaitAMXReady(conn, domainRoot ); } return domainRoot; }
Example 2
Source File: AMXGlassfish.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** Ensure that AMX is loaded and ready to use. This method returns only when all AMX subsystems have been loaded. It can be called more than once without ill effect, subsequent calls are ignored. @param conn connection to the MBeanServer @return the ObjectName of the domain-root MBean */ public ObjectName bootAMX(final MBeanServerConnection conn) throws IOException { final ObjectName domainRoot = domainRoot(); if ( !conn.isRegistered( domainRoot ) ) { // wait for the BootAMXMBean to be available (loads at startup) final BootAMXCallback callback = new BootAMXCallback(conn); listenForBootAMX(conn, callback); callback.await(); // block until the MBean appears invokeBootAMX(conn); final WaitForDomainRootListenerCallback drCallback = new WaitForDomainRootListenerCallback(conn); listenForDomainRoot(conn, drCallback); drCallback.await(); invokeWaitAMXReady(conn, domainRoot); } else { invokeWaitAMXReady(conn, domainRoot ); } return domainRoot; }
Example 3
Source File: MBeanListener.java From hottub with GNU General Public License v2.0 | 5 votes |
private boolean isRegistered( final MBeanServerConnection conn, final ObjectName objectName ) { try { return conn.isRegistered(objectName); } catch (final Exception e) { throw new RuntimeException(e); } }
Example 4
Source File: AMXGlassfish.java From hottub with GNU General Public License v2.0 | 5 votes |
/** Ensure that AMX is loaded and ready to use. This method returns only when all AMX subsystems have been loaded. It can be called more than once without ill effect, subsequent calls are ignored. @param conn connection to the MBeanServer @return the ObjectName of the domain-root MBean */ public ObjectName bootAMX(final MBeanServerConnection conn) throws IOException { final ObjectName domainRoot = domainRoot(); if ( !conn.isRegistered( domainRoot ) ) { // wait for the BootAMXMBean to be available (loads at startup) final BootAMXCallback callback = new BootAMXCallback(conn); listenForBootAMX(conn, callback); callback.await(); // block until the MBean appears invokeBootAMX(conn); final WaitForDomainRootListenerCallback drCallback = new WaitForDomainRootListenerCallback(conn); listenForDomainRoot(conn, drCallback); drCallback.await(); invokeWaitAMXReady(conn, domainRoot); } else { invokeWaitAMXReady(conn, domainRoot ); } return domainRoot; }
Example 5
Source File: MXBeanInteropTest1.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private final int doCompilationMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- CompilationMXBean") ; try { ObjectName compilationName = new ObjectName(ManagementFactory.COMPILATION_MXBEAN_NAME); if ( mbsc.isRegistered(compilationName) ) { MBeanInfo mbInfo = mbsc.getMBeanInfo(compilationName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); CompilationMXBean compilation = null ; compilation = JMX.newMXBeanProxy(mbsc, compilationName, CompilationMXBean.class) ; System.out.println("getName\t\t" + compilation.getName()); boolean supported = compilation.isCompilationTimeMonitoringSupported() ; System.out.println("isCompilationTimeMonitoringSupported\t\t" + supported); if ( supported ) { System.out.println("getTotalCompilationTime\t\t" + compilation.getTotalCompilationTime()); } } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 6
Source File: MBeanListener.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private boolean isRegistered( final MBeanServerConnection conn, final ObjectName objectName ) { try { return conn.isRegistered(objectName); } catch (final Exception e) { throw new RuntimeException(e); } }
Example 7
Source File: AMXGlassfish.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** Ensure that AMX is loaded and ready to use. This method returns only when all AMX subsystems have been loaded. It can be called more than once without ill effect, subsequent calls are ignored. @param conn connection to the MBeanServer @return the ObjectName of the domain-root MBean */ public ObjectName bootAMX(final MBeanServerConnection conn) throws IOException { final ObjectName domainRoot = domainRoot(); if ( !conn.isRegistered( domainRoot ) ) { // wait for the BootAMXMBean to be available (loads at startup) final BootAMXCallback callback = new BootAMXCallback(conn); listenForBootAMX(conn, callback); callback.await(); // block until the MBean appears invokeBootAMX(conn); final WaitForDomainRootListenerCallback drCallback = new WaitForDomainRootListenerCallback(conn); listenForDomainRoot(conn, drCallback); drCallback.await(); invokeWaitAMXReady(conn, domainRoot); } else { invokeWaitAMXReady(conn, domainRoot ); } return domainRoot; }
Example 8
Source File: MBeanListener.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private boolean isRegistered( final MBeanServerConnection conn, final ObjectName objectName ) { try { return conn.isRegistered(objectName); } catch (final Exception e) { throw new RuntimeException(e); } }
Example 9
Source File: MBeanListener.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private boolean isRegistered( final MBeanServerConnection conn, final ObjectName objectName ) { try { return conn.isRegistered(objectName); } catch (final Exception e) { throw new RuntimeException(e); } }
Example 10
Source File: MXBeanInteropTest1.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private final int doCompilationMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- CompilationMXBean") ; try { ObjectName compilationName = new ObjectName(ManagementFactory.COMPILATION_MXBEAN_NAME); if ( mbsc.isRegistered(compilationName) ) { MBeanInfo mbInfo = mbsc.getMBeanInfo(compilationName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); CompilationMXBean compilation = null ; compilation = JMX.newMXBeanProxy(mbsc, compilationName, CompilationMXBean.class) ; System.out.println("getName\t\t" + compilation.getName()); boolean supported = compilation.isCompilationTimeMonitoringSupported() ; System.out.println("isCompilationTimeMonitoringSupported\t\t" + supported); if ( supported ) { System.out.println("getTotalCompilationTime\t\t" + compilation.getTotalCompilationTime()); } } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 11
Source File: MXBeanInteropTest1.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private final int doCompilationMXBeanTest(MBeanServerConnection mbsc) { int errorCount = 0 ; System.out.println("---- CompilationMXBean") ; try { ObjectName compilationName = new ObjectName(ManagementFactory.COMPILATION_MXBEAN_NAME); if ( mbsc.isRegistered(compilationName) ) { MBeanInfo mbInfo = mbsc.getMBeanInfo(compilationName); errorCount += checkNonEmpty(mbInfo); System.out.println("getMBeanInfo\t\t" + mbInfo); CompilationMXBean compilation = null ; compilation = JMX.newMXBeanProxy(mbsc, compilationName, CompilationMXBean.class) ; System.out.println("getName\t\t" + compilation.getName()); boolean supported = compilation.isCompilationTimeMonitoringSupported() ; System.out.println("isCompilationTimeMonitoringSupported\t\t" + supported); if ( supported ) { System.out.println("getTotalCompilationTime\t\t" + compilation.getTotalCompilationTime()); } } System.out.println("---- OK\n") ; } catch (Exception e) { Utils.printThrowable(e, true) ; errorCount++ ; System.out.println("---- ERROR\n") ; } return errorCount ; }
Example 12
Source File: MBeanListener.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private boolean isRegistered( final MBeanServerConnection conn, final ObjectName objectName ) { try { return conn.isRegistered(objectName); } catch (final Exception e) { throw new RuntimeException(e); } }
Example 13
Source File: AMXGlassfish.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** Ensure that AMX is loaded and ready to use. This method returns only when all AMX subsystems have been loaded. It can be called more than once without ill effect, subsequent calls are ignored. @param conn connection to the MBeanServer @return the ObjectName of the domain-root MBean */ public ObjectName bootAMX(final MBeanServerConnection conn) throws IOException { final ObjectName domainRoot = domainRoot(); if ( !conn.isRegistered( domainRoot ) ) { // wait for the BootAMXMBean to be available (loads at startup) final BootAMXCallback callback = new BootAMXCallback(conn); listenForBootAMX(conn, callback); callback.await(); // block until the MBean appears invokeBootAMX(conn); final WaitForDomainRootListenerCallback drCallback = new WaitForDomainRootListenerCallback(conn); listenForDomainRoot(conn, drCallback); drCallback.await(); invokeWaitAMXReady(conn, domainRoot); } else { invokeWaitAMXReady(conn, domainRoot ); } return domainRoot; }
Example 14
Source File: MBeanListener.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private boolean isRegistered( final MBeanServerConnection conn, final ObjectName objectName ) { try { return conn.isRegistered(objectName); } catch (final Exception e) { throw new RuntimeException(e); } }
Example 15
Source File: MBeanListener.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private boolean isRegistered( final MBeanServerConnection conn, final ObjectName objectName ) { try { return conn.isRegistered(objectName); } catch (final Exception e) { throw new RuntimeException(e); } }
Example 16
Source File: AMXGlassfish.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** Ensure that AMX is loaded and ready to use. This method returns only when all AMX subsystems have been loaded. It can be called more than once without ill effect, subsequent calls are ignored. @param conn connection to the MBeanServer @return the ObjectName of the domain-root MBean */ public ObjectName bootAMX(final MBeanServerConnection conn) throws IOException { final ObjectName domainRoot = domainRoot(); if ( !conn.isRegistered( domainRoot ) ) { // wait for the BootAMXMBean to be available (loads at startup) final BootAMXCallback callback = new BootAMXCallback(conn); listenForBootAMX(conn, callback); callback.await(); // block until the MBean appears invokeBootAMX(conn); final WaitForDomainRootListenerCallback drCallback = new WaitForDomainRootListenerCallback(conn); listenForDomainRoot(conn, drCallback); drCallback.await(); invokeWaitAMXReady(conn, domainRoot); } else { invokeWaitAMXReady(conn, domainRoot ); } return domainRoot; }
Example 17
Source File: MBeanListener.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private boolean isRegistered( final MBeanServerConnection conn, final ObjectName objectName ) { try { return conn.isRegistered(objectName); } catch (final Exception e) { throw new RuntimeException(e); } }
Example 18
Source File: AMXGlassfish.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** Ensure that AMX is loaded and ready to use. This method returns only when all AMX subsystems have been loaded. It can be called more than once without ill effect, subsequent calls are ignored. @param conn connection to the MBeanServer @return the ObjectName of the domain-root MBean */ public ObjectName bootAMX(final MBeanServerConnection conn) throws IOException { final ObjectName domainRoot = domainRoot(); if ( !conn.isRegistered( domainRoot ) ) { // wait for the BootAMXMBean to be available (loads at startup) final BootAMXCallback callback = new BootAMXCallback(conn); listenForBootAMX(conn, callback); callback.await(); // block until the MBean appears invokeBootAMX(conn); final WaitForDomainRootListenerCallback drCallback = new WaitForDomainRootListenerCallback(conn); listenForDomainRoot(conn, drCallback); drCallback.await(); invokeWaitAMXReady(conn, domainRoot); } else { invokeWaitAMXReady(conn, domainRoot ); } return domainRoot; }
Example 19
Source File: MBeanTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * Get the ObjectName for the application * created ManagementMBean. The MBean will be * created if it is not already registered. * @throws Exception */ protected ObjectName getApplicationManagementMBean() throws Exception { /* prepare the Management mbean, which is (so far) the only MBean that * can be created/registered from a JMX client, and without knowing the * system identifier */ final ObjectName mgmtObjName = new ObjectName("com.pivotal.gemfirexd.internal", "type", "Management"); // create/register the MBean. If the same MBean has already been // registered with the MBeanServer, that MBean will be referenced. //ObjectInstance mgmtObj = final MBeanServerConnection serverConn = getMBeanServerConnection(); if (!serverConn.isRegistered(mgmtObjName)) { AccessController.doPrivileged( new PrivilegedExceptionAction<Object>() { public Object run() throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, ReflectionException, MBeanException, IOException { serverConn.createMBean( "com.pivotal.gemfirexd.internal.mbeans.Management", mgmtObjName); return null; } } ); } return mgmtObjName; }
Example 20
Source File: MemoryConsumptionTestClient.java From qpid-broker-j with Apache License 2.0 | 4 votes |
private MemoryStatistic collectMemoryStatistics(Map<String, String> options) throws Exception { String host = options.get(JMX_HOST_ARG); String port = options.get(JMX_PORT_ARG); String user = options.get(JMX_USER_ARG); String password = options.get(JMX_USER_PASSWORD_ARG); if (!"".equals(host) && !"".equals(port) && !"".equals(user) && !"".equals(password)) { Map<String, Object> environment = Collections.<String, Object>singletonMap(JMXConnector.CREDENTIALS, new String[]{user, password}); try(JMXConnector jmxConnector = JMXConnectorFactory.newJMXConnector(new JMXServiceURL("rmi", "", 0, "/jndi/rmi://" + host + ":" + port + "/jmxrmi"), environment)) { jmxConnector.connect(); final MBeanServerConnection mBeanServerConnection = jmxConnector.getMBeanServerConnection(); final ObjectName memoryMBean = new ObjectName("java.lang:type=Memory"); String gcCollectorMBeanName = options.get(JMX_GARBAGE_COLLECTOR_MBEAN); if (gcCollectorMBeanName.equals("")) { mBeanServerConnection.invoke(memoryMBean, "gc", null, null); MemoryStatistic memoryStatistics = new MemoryStatistic(); collectMemoryStatistics(memoryStatistics, mBeanServerConnection, memoryMBean); return memoryStatistics; } else { ObjectName gcMBean = new ObjectName(gcCollectorMBeanName); if (mBeanServerConnection.isRegistered(gcMBean)) { return collectMemoryStatisticsAfterGCNotification(mBeanServerConnection, gcMBean); } else { Set<ObjectName> existingGCs = mBeanServerConnection.queryNames(new ObjectName("java.lang:type=GarbageCollector,name=*"), null); throw new IllegalArgumentException("MBean '" +gcCollectorMBeanName + "' does not exists! Registered GC MBeans :" + existingGCs); } } } } return null; }