类javax.management.MBeanFeatureInfo源码实例Demo

下面列出了怎么用javax.management.MBeanFeatureInfo的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: tomee   文件: ManagedMBean.java
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
    }
}
 
源代码2 项目: vjtools   文件: Client.java
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;
}
 
源代码3 项目: vjtools   文件: Client.java
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;
}
 
源代码4 项目: LagMonitor   文件: FlightCommand.java
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;
    }
}
 
源代码5 项目: ignite   文件: JmxExporterSpiTest.java
/** */
@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());
}
 
源代码6 项目: ignite   文件: JmxExporterSpiTest.java
/** */
@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));
}
 
源代码7 项目: LagMonitor   文件: FlightCommand.java
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;
    }
}
 
源代码8 项目: vjtools   文件: Client.java
protected static boolean isFeatureInfo(MBeanFeatureInfo[] infos, String cmd) {
	return getFeatureInfo(infos, cmd) != null;
}
 
源代码9 项目: vjtools   文件: Client.java
protected static boolean isFeatureInfo(MBeanFeatureInfo[] infos, String cmd) {
	return getFeatureInfo(infos, cmd) != null;
}
 
源代码10 项目: tomee   文件: ManagedMBean.java
@Override
public int compare(final MBeanFeatureInfo o1, final MBeanFeatureInfo o2) {
    return o1.getName().compareTo(o2.getName());
}
 
/**
 * 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;
}
 
/**
 * 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;
}
 
源代码13 项目: jdk8u60   文件: MBeanFeatureInfoSerialStore.java
/**
 * 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;
}
 
/**
 * 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;
}
 
/**
 * 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;
}
 
源代码16 项目: openjdk-jdk9   文件: MBeanFeatureInfoSerialStore.java
/**
 * 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;
}
 
源代码17 项目: jdk8u-jdk   文件: MBeanFeatureInfoSerialStore.java
/**
 * 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;
}
 
源代码18 项目: hottub   文件: MBeanFeatureInfoSerialStore.java
/**
 * 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;
}
 
/**
 * 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;
}
 
源代码20 项目: openjdk-8   文件: MBeanFeatureInfoSerialStore.java
/**
 * 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;
}
 
源代码21 项目: jdk8u_jdk   文件: MBeanFeatureInfoSerialStore.java
/**
 * 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;
}
 
源代码22 项目: jdk8u-jdk   文件: MBeanFeatureInfoSerialStore.java
/**
 * 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;
}
 
/**
 * 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;
}
 
源代码24 项目: nexus-public   文件: MBeanFeature.java
/**
 * Feature information.
 */
MBeanFeatureInfo getInfo();
 
源代码25 项目: sis   文件: Supervisor.java
/**
 * 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());
}
 
 类所在包
 同包方法