javax.management.MBeanFeatureInfo Java Examples

The following examples show how to use javax.management.MBeanFeatureInfo. 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: ManagedMBean.java    From tomee with Apache License 2.0 6 votes vote down vote up
public void setAttributesFilter(String exclude, String include) {
    if (include == null) {
        include = "";
    }
    if (exclude == null) {
        exclude = "";
    }
    includes = Pattern.compile(include);
    excludes = Pattern.compile(exclude);

    try {
        // Set the current value as the description
        final Field field = MBeanFeatureInfo.class.getDeclaredField("description");
        field.setAccessible(true);
        field.set(includeInfo, "\"" + includes.pattern() + "\"");
        field.set(excludeInfo, "\"" + excludes.pattern() + "\"");
    } catch (final Exception e) {
        // Oh well, we tried
    }
}
 
Example #2
Source File: Client.java    From vjtools with Apache License 2.0 5 votes vote down vote up
protected static MBeanFeatureInfo getFeatureInfo(MBeanFeatureInfo[] infos, String cmd) {
	// Cmd may be carrying arguments. Don't count them in the compare.
	int index = cmd.indexOf('=');
	String name = (index > 0) ? cmd.substring(0, index) : cmd;
	for (int i = 0; i < infos.length; i++) {
		if (infos[i].getName().equals(name)) {
			return infos[i];
		}
	}
	return null;
}
 
Example #3
Source File: Client.java    From vjtools with Apache License 2.0 5 votes vote down vote up
protected static MBeanFeatureInfo getFeatureInfo(MBeanFeatureInfo[] infos, String cmd) {
	// Cmd may be carrying arguments. Don't count them in the compare.
	int index = cmd.indexOf('=');
	String name = (index > 0) ? cmd.substring(0, index) : cmd;
	for (int i = 0; i < infos.length; i++) {
		if (infos[i].getName().equals(name)) {
			return infos[i];
		}
	}
	return null;
}
 
Example #4
Source File: FlightCommand.java    From LagMonitor with MIT License 5 votes vote down vote up
private boolean areFlightMethodsAvailable() {
    MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer();
    try {
        ObjectName objectName = ObjectName.getInstance(DIAGNOSTIC_BEAN);
        MBeanInfo beanInfo = beanServer.getMBeanInfo(objectName);
        return Arrays.stream(beanInfo.getOperations())
                .map(MBeanFeatureInfo::getName)
                .anyMatch(op -> op.contains("jfr"));
    } catch (JMException instanceNotFoundEx) {
        return false;
    }
}
 
Example #5
Source File: JmxExporterSpiTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** */
@Test
public void testDataRegionJmxMetrics() throws Exception {
    DynamicMBean dataRegionMBean = metricRegistry(ignite.name(), "io", "dataregion.default");

    Set<String> res = stream(dataRegionMBean.getMBeanInfo().getAttributes())
        .map(MBeanFeatureInfo::getName)
        .collect(toSet());

    assertTrue(res.containsAll(EXPECTED_ATTRIBUTES));

    for (String metricName : res)
        assertNotNull(metricName, dataRegionMBean.getAttribute(metricName));
}
 
Example #6
Source File: JmxExporterSpiTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** */
@Test
public void testSysJmxMetrics() throws Exception {
    DynamicMBean sysMBean = metricRegistry(ignite.name(), null, SYS_METRICS);

    Set<String> res = stream(sysMBean.getMBeanInfo().getAttributes())
        .map(MBeanFeatureInfo::getName)
        .collect(toSet());

    assertTrue(res.contains(CPU_LOAD));
    assertTrue(res.contains(GC_CPU_LOAD));
    assertTrue(res.contains(metricName("memory", "heap", "init")));
    assertTrue(res.contains(metricName("memory", "heap", "used")));
    assertTrue(res.contains(metricName("memory", "nonheap", "committed")));
    assertTrue(res.contains(metricName("memory", "nonheap", "max")));

    Optional<MBeanAttributeInfo> cpuLoad = stream(sysMBean.getMBeanInfo().getAttributes())
        .filter(a -> a.getName().equals(CPU_LOAD))
        .findFirst();

    assertTrue(cpuLoad.isPresent());
    assertEquals(CPU_LOAD_DESCRIPTION, cpuLoad.get().getDescription());

    Optional<MBeanAttributeInfo> gcCpuLoad = stream(sysMBean.getMBeanInfo().getAttributes())
        .filter(a -> a.getName().equals(GC_CPU_LOAD))
        .findFirst();

    assertTrue(gcCpuLoad.isPresent());
    assertEquals(GC_CPU_LOAD_DESCRIPTION, gcCpuLoad.get().getDescription());
}
 
Example #7
Source File: FlightCommand.java    From LagMonitor with MIT License 5 votes vote down vote up
private boolean areFlightMethodsAvailable() {
    MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer();
    try {
        ObjectName objectName = ObjectName.getInstance(DIAGNOSTIC_BEAN);
        MBeanInfo beanInfo = beanServer.getMBeanInfo(objectName);
        return Arrays.stream(beanInfo.getOperations())
                .map(MBeanFeatureInfo::getName)
                .anyMatch(op -> op.contains("jfr"));
    } catch (JMException instanceNotFoundEx) {
        return false;
    }
}
 
Example #8
Source File: ManagedMBean.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public int compare(final MBeanFeatureInfo o1, final MBeanFeatureInfo o2) {
    return o1.getName().compareTo(o2.getName());
}
 
Example #9
Source File: Client.java    From vjtools with Apache License 2.0 4 votes vote down vote up
protected static boolean isFeatureInfo(MBeanFeatureInfo[] infos, String cmd) {
	return getFeatureInfo(infos, cmd) != null;
}
 
Example #10
Source File: Client.java    From vjtools with Apache License 2.0 4 votes vote down vote up
protected static boolean isFeatureInfo(MBeanFeatureInfo[] infos, String cmd) {
	return getFeatureInfo(infos, cmd) != null;
}
 
Example #11
Source File: MBeanFeatureInfoSerialStore.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #12
Source File: MBeanFeatureInfoSerialStore.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #13
Source File: MBeanFeatureInfoSerialStore.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #14
Source File: MBeanFeatureInfoSerialStore.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #15
Source File: MBeanFeatureInfoSerialStore.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #16
Source File: MBeanFeatureInfoSerialStore.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #17
Source File: MBeanFeatureInfoSerialStore.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #18
Source File: MBeanFeatureInfoSerialStore.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #19
Source File: MBeanFeatureInfoSerialStore.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #20
Source File: MBeanFeatureInfoSerialStore.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #21
Source File: MBeanFeatureInfoSerialStore.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #22
Source File: MBeanFeatureInfoSerialStore.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #23
Source File: MBeanFeatureInfoSerialStore.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retrieves and deserializes the object stored at the given key.
 * @return The deserialized object.
 * @throws IOException if the object cannot be deserialized.
 * @throws ClassNotFoundException if the class of the serialized object
 *         cannot be loaded.
 **/
public static MBeanFeatureInfo get(String name)
throws IOException, ClassNotFoundException {
    final byte[] bytes = map.get(name);
    final Object obj = deserialize(bytes);
    return (MBeanFeatureInfo)obj;
}
 
Example #24
Source File: MBeanFeature.java    From nexus-public with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Feature information.
 */
MBeanFeatureInfo getInfo();
 
Example #25
Source File: Supervisor.java    From sis with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the localized description for the given constructor, attribute or operation.
 *
 * @return a localized description for the given attribute or operation.
 */
@Override
protected String getDescription(final MBeanFeatureInfo info) {
    return getDescription(info.getName());
}