Java Code Examples for javax.management.JMX#isMXBeanInterface()
The following examples show how to use
javax.management.JMX#isMXBeanInterface() .
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: MBeanClientInterceptor.java From spring-analysis-note with MIT License | 6 votes |
/** * Ensures that an {@code MBeanServerConnection} is configured and attempts * to detect a local connection if one is not supplied. */ public void prepare() { synchronized (this.preparationMonitor) { if (this.server != null) { this.serverToUse = this.server; } else { this.serverToUse = null; this.serverToUse = this.connector.connect(this.serviceUrl, this.environment, this.agentId); } this.invocationHandler = null; if (this.useStrictCasing) { Assert.state(this.objectName != null, "No ObjectName set"); // Use the JDK's own MBeanServerInvocationHandler, in particular for native MXBean support. this.invocationHandler = new MBeanServerInvocationHandler(this.serverToUse, this.objectName, (this.managementInterface != null && JMX.isMXBeanInterface(this.managementInterface))); } else { // Non-strict casing can only be achieved through custom invocation handling. // Only partial MXBean support available! retrieveMBeanInfo(this.serverToUse); } } }
Example 2
Source File: MBeanClientInterceptor.java From java-technology-stack with MIT License | 6 votes |
/** * Ensures that an {@code MBeanServerConnection} is configured and attempts * to detect a local connection if one is not supplied. */ public void prepare() { synchronized (this.preparationMonitor) { if (this.server != null) { this.serverToUse = this.server; } else { this.serverToUse = null; this.serverToUse = this.connector.connect(this.serviceUrl, this.environment, this.agentId); } this.invocationHandler = null; if (this.useStrictCasing) { Assert.state(this.objectName != null, "No ObjectName set"); // Use the JDK's own MBeanServerInvocationHandler, in particular for native MXBean support. this.invocationHandler = new MBeanServerInvocationHandler(this.serverToUse, this.objectName, (this.managementInterface != null && JMX.isMXBeanInterface(this.managementInterface))); } else { // Non-strict casing can only be achieved through custom invocation handling. // Only partial MXBean support available! retrieveMBeanInfo(this.serverToUse); } } }
Example 3
Source File: MBeanClientInterceptor.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Ensures that an {@code MBeanServerConnection} is configured and attempts * to detect a local connection if one is not supplied. */ public void prepare() { synchronized (this.preparationMonitor) { if (this.server != null) { this.serverToUse = this.server; } else { this.serverToUse = null; this.serverToUse = this.connector.connect(this.serviceUrl, this.environment, this.agentId); } this.invocationHandler = null; if (this.useStrictCasing) { // Use the JDK's own MBeanServerInvocationHandler, in particular for native MXBean support. this.invocationHandler = new MBeanServerInvocationHandler(this.serverToUse, this.objectName, (this.managementInterface != null && JMX.isMXBeanInterface(this.managementInterface))); } else { // Non-strict casing can only be achieved through custom invocation handling. // Only partial MXBean support available! retrieveMBeanInfo(); } } }
Example 4
Source File: MBeanClientInterceptor.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Ensures that an {@code MBeanServerConnection} is configured and attempts * to detect a local connection if one is not supplied. */ public void prepare() { synchronized (this.preparationMonitor) { if (this.server != null) { this.serverToUse = this.server; } else { this.serverToUse = null; this.serverToUse = this.connector.connect(this.serviceUrl, this.environment, this.agentId); } this.invocationHandler = null; if (this.useStrictCasing) { // Use the JDK's own MBeanServerInvocationHandler, in particular for native MXBean support. this.invocationHandler = new MBeanServerInvocationHandler(this.serverToUse, this.objectName, (this.managementInterface != null && JMX.isMXBeanInterface(this.managementInterface))); } else { // Non-strict casing can only be achieved through custom invocation handling. // Only partial MXBean support available! retrieveMBeanInfo(); } } }
Example 5
Source File: MBeanProxyInvocationHandler.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
/** * * @param member * member to which this MBean belongs * @param monitoringRegion * corresponding MonitoringRegion * @param objectName * ObjectName of the MBean * @param interfaceClass * on which interface the proxy to be exposed * @return Object * @throws ClassNotFoundException * @throws IntrospectionException */ public static Object newProxyInstance(DistributedMember member, Region<String, Object> monitoringRegion, ObjectName objectName, Class interfaceClass) throws ClassNotFoundException, IntrospectionException { boolean isMXBean = JMX.isMXBeanInterface(interfaceClass); boolean notificationBroadcaster = ((FederationComponent) monitoringRegion .get(objectName.toString())).isNotificationEmitter(); InvocationHandler handler = new MBeanProxyInvocationHandler(member, objectName, monitoringRegion, isMXBean); Class[] interfaces; if (notificationBroadcaster) { interfaces = new Class[] { interfaceClass, ProxyInterface.class, NotificationBroadCasterProxy.class }; } else { interfaces = new Class[] { interfaceClass, ProxyInterface.class }; } Object proxy = Proxy.newProxyInstance(MBeanProxyInvocationHandler.class .getClassLoader(), interfaces, handler); return interfaceClass.cast(proxy); }
Example 6
Source File: MBeanProxyInvocationHandler.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
/** * * @param member * member to which this MBean belongs * @param monitoringRegion * corresponding MonitoringRegion * @param objectName * ObjectName of the MBean * @param interfaceClass * on which interface the proxy to be exposed * @return Object * @throws ClassNotFoundException * @throws IntrospectionException */ public static Object newProxyInstance(DistributedMember member, Region<String, Object> monitoringRegion, ObjectName objectName, Class interfaceClass) throws ClassNotFoundException, IntrospectionException { boolean isMXBean = JMX.isMXBeanInterface(interfaceClass); boolean notificationBroadcaster = ((FederationComponent) monitoringRegion .get(objectName.toString())).isNotificationEmitter(); InvocationHandler handler = new MBeanProxyInvocationHandler(member, objectName, monitoringRegion, isMXBean); Class[] interfaces; if (notificationBroadcaster) { interfaces = new Class[] { interfaceClass, ProxyInterface.class, NotificationBroadCasterProxy.class }; } else { interfaces = new Class[] { interfaceClass, ProxyInterface.class }; } Object proxy = Proxy.newProxyInstance(MBeanProxyInvocationHandler.class .getClassLoader(), interfaces, handler); return interfaceClass.cast(proxy); }
Example 7
Source File: JmxUtils.java From spring-analysis-note with MIT License | 5 votes |
/** * Return the Java 6 MXBean interface exists for the given class, if any * (that is, an interface whose name ends with "MXBean" and/or * carries an appropriate MXBean annotation). * @param clazz the class to check * @return whether there is an MXBean interface for the given class */ @Nullable public static Class<?> getMXBeanInterface(@Nullable Class<?> clazz) { if (clazz == null || clazz.getSuperclass() == null) { return null; } Class<?>[] implementedInterfaces = clazz.getInterfaces(); for (Class<?> iface : implementedInterfaces) { if (JMX.isMXBeanInterface(iface)) { return iface; } } return getMXBeanInterface(clazz.getSuperclass()); }
Example 8
Source File: JmxUtils.java From java-technology-stack with MIT License | 5 votes |
/** * Return the Java 6 MXBean interface exists for the given class, if any * (that is, an interface whose name ends with "MXBean" and/or * carries an appropriate MXBean annotation). * @param clazz the class to check * @return whether there is an MXBean interface for the given class */ @Nullable public static Class<?> getMXBeanInterface(@Nullable Class<?> clazz) { if (clazz == null || clazz.getSuperclass() == null) { return null; } Class<?>[] implementedInterfaces = clazz.getInterfaces(); for (Class<?> iface : implementedInterfaces) { if (JMX.isMXBeanInterface(iface)) { return iface; } } return getMXBeanInterface(clazz.getSuperclass()); }
Example 9
Source File: JmxUtils.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Return the Java 6 MXBean interface exists for the given class, if any * (that is, an interface whose name ends with "MXBean" and/or * carries an appropriate MXBean annotation). * @param clazz the class to check * @return whether there is an MXBean interface for the given class */ public static Class<?> getMXBeanInterface(Class<?> clazz) { if (clazz == null || clazz.getSuperclass() == null) { return null; } Class<?>[] implementedInterfaces = clazz.getInterfaces(); for (Class<?> iface : implementedInterfaces) { if (JMX.isMXBeanInterface(iface)) { return iface; } } return getMXBeanInterface(clazz.getSuperclass()); }
Example 10
Source File: JmxUtils.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Return the Java 6 MXBean interface exists for the given class, if any * (that is, an interface whose name ends with "MXBean" and/or * carries an appropriate MXBean annotation). * @param clazz the class to check * @return whether there is an MXBean interface for the given class */ public static Class<?> getMXBeanInterface(Class<?> clazz) { if (clazz == null || clazz.getSuperclass() == null) { return null; } Class<?>[] implementedInterfaces = clazz.getInterfaces(); for (Class<?> iface : implementedInterfaces) { if (JMX.isMXBeanInterface(iface)) { return iface; } } return getMXBeanInterface(clazz.getSuperclass()); }
Example 11
Source File: JmxOperationInvoker.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public <T> T getMBeanProxy(final ObjectName objectName, final Class<T> mbeanInterface) { if (DistributedSystemMXBean.class.equals(mbeanInterface) && ManagementConstants.OBJECTNAME__DISTRIBUTEDSYSTEM_MXBEAN.equals(objectName.toString())) { return mbeanInterface.cast(getDistributedSystemMXBean()); } else if (JMX.isMXBeanInterface(mbeanInterface)) { return JMX.newMXBeanProxy(getMBeanServerConnection(), objectName, mbeanInterface); } else { return JMX.newMBeanProxy(getMBeanServerConnection(), objectName, mbeanInterface); } }
Example 12
Source File: JmxOperationInvoker.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public <T> T getMBeanProxy(final ObjectName objectName, final Class<T> mbeanInterface) { if (DistributedSystemMXBean.class.equals(mbeanInterface) && ManagementConstants.OBJECTNAME__DISTRIBUTEDSYSTEM_MXBEAN.equals(objectName.toString())) { return mbeanInterface.cast(getDistributedSystemMXBean()); } else if (JMX.isMXBeanInterface(mbeanInterface)) { return JMX.newMXBeanProxy(getMBeanServerConnection(), objectName, mbeanInterface); } else { return JMX.newMBeanProxy(getMBeanServerConnection(), objectName, mbeanInterface); } }