Java Code Examples for javax.management.ObjectName#WILDCARD

The following examples show how to use javax.management.ObjectName#WILDCARD . 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: DelegateNameWildcardNameTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        System.out.println(
            "Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
            "<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
        final ObjectName delegateName =
                new ObjectName("JMImplementation:type=MBeanServerDelegate");
        if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
            throw new AssertionError("Unexpected value: " +
                    "MBeanServerDelegate.DELEGATE_NAME = " +
                    MBeanServerDelegate.DELEGATE_NAME);
        System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
                "new ObjectName(\"" + delegateName + "\")");

        System.out.println("Test that <ObjectName.WILDCARD> " +
                           "equals <new ObjectName(\"*:*\")>");
        final ObjectName wildcardName = new ObjectName("*:*");
        if (!wildcardName.equals(ObjectName.WILDCARD))
            throw new AssertionError("Unexpected value: " +
                    "ObjectName.WILDCARD = " +
                    ObjectName.WILDCARD);
        System.out.println("ObjectName.WILDCARD = " +
                "new ObjectName(\"" + wildcardName + "\")");

        System.out.println("Test passes: constants were initialized properly");
    }
 
Example 2
Source File: OldMBeanServerTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
    Set<ObjectInstance> instances = newSet();
    if (name == null)
        name = ObjectName.WILDCARD;
    if (query == null)
        query = trueQuery;
    MBeanServer oldMBS = QueryEval.getMBeanServer();
    try {
        query.setMBeanServer(this);
        for (ObjectName n : mbeans.keySet()) {
            if (name.apply(n)) {
                try {
                    if (query.apply(n))
                        instances.add(getObjectInstance(n));
                } catch (Exception e) {
                    // OK: Ignore this MBean in the result
                }
            }
        }
    } finally {
        query.setMBeanServer(oldMBS);
    }
    return instances;
}
 
Example 3
Source File: DelegateNameWildcardNameTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        System.out.println(
            "Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
            "<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
        final ObjectName delegateName =
                new ObjectName("JMImplementation:type=MBeanServerDelegate");
        if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
            throw new AssertionError("Unexpected value: " +
                    "MBeanServerDelegate.DELEGATE_NAME = " +
                    MBeanServerDelegate.DELEGATE_NAME);
        System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
                "new ObjectName(\"" + delegateName + "\")");

        System.out.println("Test that <ObjectName.WILDCARD> " +
                           "equals <new ObjectName(\"*:*\")>");
        final ObjectName wildcardName = new ObjectName("*:*");
        if (!wildcardName.equals(ObjectName.WILDCARD))
            throw new AssertionError("Unexpected value: " +
                    "ObjectName.WILDCARD = " +
                    ObjectName.WILDCARD);
        System.out.println("ObjectName.WILDCARD = " +
                "new ObjectName(\"" + wildcardName + "\")");

        System.out.println("Test passes: constants were initialized properly");
    }
 
Example 4
Source File: OldMBeanServerTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
    Set<ObjectInstance> instances = newSet();
    if (name == null)
        name = ObjectName.WILDCARD;
    if (query == null)
        query = trueQuery;
    MBeanServer oldMBS = QueryEval.getMBeanServer();
    try {
        query.setMBeanServer(this);
        for (ObjectName n : mbeans.keySet()) {
            if (name.apply(n)) {
                try {
                    if (query.apply(n))
                        instances.add(getObjectInstance(n));
                } catch (Exception e) {
                    // OK: Ignore this MBean in the result
                }
            }
        }
    } finally {
        query.setMBeanServer(oldMBS);
    }
    return instances;
}
 
Example 5
Source File: DelegateNameWildcardNameTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        System.out.println(
            "Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
            "<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
        final ObjectName delegateName =
                new ObjectName("JMImplementation:type=MBeanServerDelegate");
        if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
            throw new AssertionError("Unexpected value: " +
                    "MBeanServerDelegate.DELEGATE_NAME = " +
                    MBeanServerDelegate.DELEGATE_NAME);
        System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
                "new ObjectName(\"" + delegateName + "\")");

        System.out.println("Test that <ObjectName.WILDCARD> " +
                           "equals <new ObjectName(\"*:*\")>");
        final ObjectName wildcardName = new ObjectName("*:*");
        if (!wildcardName.equals(ObjectName.WILDCARD))
            throw new AssertionError("Unexpected value: " +
                    "ObjectName.WILDCARD = " +
                    ObjectName.WILDCARD);
        System.out.println("ObjectName.WILDCARD = " +
                "new ObjectName(\"" + wildcardName + "\")");

        System.out.println("Test passes: constants were initialized properly");
    }
 
Example 6
Source File: OldMBeanServerTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
    Set<ObjectInstance> instances = newSet();
    if (name == null)
        name = ObjectName.WILDCARD;
    if (query == null)
        query = trueQuery;
    MBeanServer oldMBS = QueryEval.getMBeanServer();
    try {
        query.setMBeanServer(this);
        for (ObjectName n : mbeans.keySet()) {
            if (name.apply(n)) {
                try {
                    if (query.apply(n))
                        instances.add(getObjectInstance(n));
                } catch (Exception e) {
                    // OK: Ignore this MBean in the result
                }
            }
        }
    } finally {
        query.setMBeanServer(oldMBS);
    }
    return instances;
}
 
Example 7
Source File: DelegateNameWildcardNameTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        System.out.println(
            "Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
            "<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
        final ObjectName delegateName =
                new ObjectName("JMImplementation:type=MBeanServerDelegate");
        if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
            throw new AssertionError("Unexpected value: " +
                    "MBeanServerDelegate.DELEGATE_NAME = " +
                    MBeanServerDelegate.DELEGATE_NAME);
        System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
                "new ObjectName(\"" + delegateName + "\")");

        System.out.println("Test that <ObjectName.WILDCARD> " +
                           "equals <new ObjectName(\"*:*\")>");
        final ObjectName wildcardName = new ObjectName("*:*");
        if (!wildcardName.equals(ObjectName.WILDCARD))
            throw new AssertionError("Unexpected value: " +
                    "ObjectName.WILDCARD = " +
                    ObjectName.WILDCARD);
        System.out.println("ObjectName.WILDCARD = " +
                "new ObjectName(\"" + wildcardName + "\")");

        System.out.println("Test passes: constants were initialized properly");
    }
 
Example 8
Source File: OldMBeanServerTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
    Set<ObjectInstance> instances = newSet();
    if (name == null)
        name = ObjectName.WILDCARD;
    if (query == null)
        query = trueQuery;
    MBeanServer oldMBS = QueryEval.getMBeanServer();
    try {
        query.setMBeanServer(this);
        for (ObjectName n : mbeans.keySet()) {
            if (name.apply(n)) {
                try {
                    if (query.apply(n))
                        instances.add(getObjectInstance(n));
                } catch (Exception e) {
                    // OK: Ignore this MBean in the result
                }
            }
        }
    } finally {
        query.setMBeanServer(oldMBS);
    }
    return instances;
}
 
Example 9
Source File: DelegateNameWildcardNameTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        System.out.println(
            "Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
            "<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
        final ObjectName delegateName =
                new ObjectName("JMImplementation:type=MBeanServerDelegate");
        if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
            throw new AssertionError("Unexpected value: " +
                    "MBeanServerDelegate.DELEGATE_NAME = " +
                    MBeanServerDelegate.DELEGATE_NAME);
        System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
                "new ObjectName(\"" + delegateName + "\")");

        System.out.println("Test that <ObjectName.WILDCARD> " +
                           "equals <new ObjectName(\"*:*\")>");
        final ObjectName wildcardName = new ObjectName("*:*");
        if (!wildcardName.equals(ObjectName.WILDCARD))
            throw new AssertionError("Unexpected value: " +
                    "ObjectName.WILDCARD = " +
                    ObjectName.WILDCARD);
        System.out.println("ObjectName.WILDCARD = " +
                "new ObjectName(\"" + wildcardName + "\")");

        System.out.println("Test passes: constants were initialized properly");
    }
 
Example 10
Source File: OldMBeanServerTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
    Set<ObjectInstance> instances = newSet();
    if (name == null)
        name = ObjectName.WILDCARD;
    if (query == null)
        query = trueQuery;
    MBeanServer oldMBS = QueryEval.getMBeanServer();
    try {
        query.setMBeanServer(this);
        for (ObjectName n : mbeans.keySet()) {
            if (name.apply(n)) {
                try {
                    if (query.apply(n))
                        instances.add(getObjectInstance(n));
                } catch (Exception e) {
                    // OK: Ignore this MBean in the result
                }
            }
        }
    } finally {
        query.setMBeanServer(oldMBS);
    }
    return instances;
}
 
Example 11
Source File: DelegateNameWildcardNameTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        System.out.println(
            "Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
            "<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
        final ObjectName delegateName =
                new ObjectName("JMImplementation:type=MBeanServerDelegate");
        if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
            throw new AssertionError("Unexpected value: " +
                    "MBeanServerDelegate.DELEGATE_NAME = " +
                    MBeanServerDelegate.DELEGATE_NAME);
        System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
                "new ObjectName(\"" + delegateName + "\")");

        System.out.println("Test that <ObjectName.WILDCARD> " +
                           "equals <new ObjectName(\"*:*\")>");
        final ObjectName wildcardName = new ObjectName("*:*");
        if (!wildcardName.equals(ObjectName.WILDCARD))
            throw new AssertionError("Unexpected value: " +
                    "ObjectName.WILDCARD = " +
                    ObjectName.WILDCARD);
        System.out.println("ObjectName.WILDCARD = " +
                "new ObjectName(\"" + wildcardName + "\")");

        System.out.println("Test passes: constants were initialized properly");
    }
 
Example 12
Source File: OldMBeanServerTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
    Set<ObjectInstance> instances = newSet();
    if (name == null)
        name = ObjectName.WILDCARD;
    if (query == null)
        query = trueQuery;
    MBeanServer oldMBS = QueryEval.getMBeanServer();
    try {
        query.setMBeanServer(this);
        for (ObjectName n : mbeans.keySet()) {
            if (name.apply(n)) {
                try {
                    if (query.apply(n))
                        instances.add(getObjectInstance(n));
                } catch (Exception e) {
                    // OK: Ignore this MBean in the result
                }
            }
        }
    } finally {
        query.setMBeanServer(oldMBS);
    }
    return instances;
}
 
Example 13
Source File: DelegateNameWildcardNameTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        System.out.println(
            "Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
            "<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
        final ObjectName delegateName =
                new ObjectName("JMImplementation:type=MBeanServerDelegate");
        if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
            throw new AssertionError("Unexpected value: " +
                    "MBeanServerDelegate.DELEGATE_NAME = " +
                    MBeanServerDelegate.DELEGATE_NAME);
        System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
                "new ObjectName(\"" + delegateName + "\")");

        System.out.println("Test that <ObjectName.WILDCARD> " +
                           "equals <new ObjectName(\"*:*\")>");
        final ObjectName wildcardName = new ObjectName("*:*");
        if (!wildcardName.equals(ObjectName.WILDCARD))
            throw new AssertionError("Unexpected value: " +
                    "ObjectName.WILDCARD = " +
                    ObjectName.WILDCARD);
        System.out.println("ObjectName.WILDCARD = " +
                "new ObjectName(\"" + wildcardName + "\")");

        System.out.println("Test passes: constants were initialized properly");
    }
 
Example 14
Source File: DelegateNameWildcardNameTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        System.out.println(
            "Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
            "<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
        final ObjectName delegateName =
                new ObjectName("JMImplementation:type=MBeanServerDelegate");
        if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
            throw new AssertionError("Unexpected value: " +
                    "MBeanServerDelegate.DELEGATE_NAME = " +
                    MBeanServerDelegate.DELEGATE_NAME);
        System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
                "new ObjectName(\"" + delegateName + "\")");

        System.out.println("Test that <ObjectName.WILDCARD> " +
                           "equals <new ObjectName(\"*:*\")>");
        final ObjectName wildcardName = new ObjectName("*:*");
        if (!wildcardName.equals(ObjectName.WILDCARD))
            throw new AssertionError("Unexpected value: " +
                    "ObjectName.WILDCARD = " +
                    ObjectName.WILDCARD);
        System.out.println("ObjectName.WILDCARD = " +
                "new ObjectName(\"" + wildcardName + "\")");

        System.out.println("Test passes: constants were initialized properly");
    }
 
Example 15
Source File: DelegateNameWildcardNameTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        System.out.println(
            "Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
            "<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
        final ObjectName delegateName =
                new ObjectName("JMImplementation:type=MBeanServerDelegate");
        if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
            throw new AssertionError("Unexpected value: " +
                    "MBeanServerDelegate.DELEGATE_NAME = " +
                    MBeanServerDelegate.DELEGATE_NAME);
        System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
                "new ObjectName(\"" + delegateName + "\")");

        System.out.println("Test that <ObjectName.WILDCARD> " +
                           "equals <new ObjectName(\"*:*\")>");
        final ObjectName wildcardName = new ObjectName("*:*");
        if (!wildcardName.equals(ObjectName.WILDCARD))
            throw new AssertionError("Unexpected value: " +
                    "ObjectName.WILDCARD = " +
                    ObjectName.WILDCARD);
        System.out.println("ObjectName.WILDCARD = " +
                "new ObjectName(\"" + wildcardName + "\")");

        System.out.println("Test passes: constants were initialized properly");
    }
 
Example 16
Source File: OldMBeanServerTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
    Set<ObjectInstance> instances = newSet();
    if (name == null)
        name = ObjectName.WILDCARD;
    if (query == null)
        query = trueQuery;
    MBeanServer oldMBS = QueryEval.getMBeanServer();
    try {
        query.setMBeanServer(this);
        for (ObjectName n : mbeans.keySet()) {
            if (name.apply(n)) {
                try {
                    if (query.apply(n))
                        instances.add(getObjectInstance(n));
                } catch (Exception e) {
                    // OK: Ignore this MBean in the result
                }
            }
        }
    } finally {
        query.setMBeanServer(oldMBS);
    }
    return instances;
}
 
Example 17
Source File: DelegateNameWildcardNameTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        System.out.println(
            "Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
            "<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
        final ObjectName delegateName =
                new ObjectName("JMImplementation:type=MBeanServerDelegate");
        if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
            throw new AssertionError("Unexpected value: " +
                    "MBeanServerDelegate.DELEGATE_NAME = " +
                    MBeanServerDelegate.DELEGATE_NAME);
        System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
                "new ObjectName(\"" + delegateName + "\")");

        System.out.println("Test that <ObjectName.WILDCARD> " +
                           "equals <new ObjectName(\"*:*\")>");
        final ObjectName wildcardName = new ObjectName("*:*");
        if (!wildcardName.equals(ObjectName.WILDCARD))
            throw new AssertionError("Unexpected value: " +
                    "ObjectName.WILDCARD = " +
                    ObjectName.WILDCARD);
        System.out.println("ObjectName.WILDCARD = " +
                "new ObjectName(\"" + wildcardName + "\")");

        System.out.println("Test passes: constants were initialized properly");
    }
 
Example 18
Source File: DelegateNameWildcardNameTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        System.out.println(
            "Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
            "<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
        final ObjectName delegateName =
                new ObjectName("JMImplementation:type=MBeanServerDelegate");
        if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
            throw new AssertionError("Unexpected value: " +
                    "MBeanServerDelegate.DELEGATE_NAME = " +
                    MBeanServerDelegate.DELEGATE_NAME);
        System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
                "new ObjectName(\"" + delegateName + "\")");

        System.out.println("Test that <ObjectName.WILDCARD> " +
                           "equals <new ObjectName(\"*:*\")>");
        final ObjectName wildcardName = new ObjectName("*:*");
        if (!wildcardName.equals(ObjectName.WILDCARD))
            throw new AssertionError("Unexpected value: " +
                    "ObjectName.WILDCARD = " +
                    ObjectName.WILDCARD);
        System.out.println("ObjectName.WILDCARD = " +
                "new ObjectName(\"" + wildcardName + "\")");

        System.out.println("Test passes: constants were initialized properly");
    }
 
Example 19
Source File: OldMBeanServerTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
    Set<ObjectInstance> instances = newSet();
    if (name == null)
        name = ObjectName.WILDCARD;
    if (query == null)
        query = trueQuery;
    MBeanServer oldMBS = QueryEval.getMBeanServer();
    try {
        query.setMBeanServer(this);
        for (ObjectName n : mbeans.keySet()) {
            if (name.apply(n)) {
                try {
                    if (query.apply(n))
                        instances.add(getObjectInstance(n));
                } catch (Exception e) {
                    // OK: Ignore this MBean in the result
                }
            }
        }
    } finally {
        query.setMBeanServer(oldMBS);
    }
    return instances;
}
 
Example 20
Source File: Supervisor.java    From sis with Apache License 2.0 5 votes vote down vote up
/**
 * Unregister the {@code Supervisor} instance. This method does nothing if the supervisor
 * has not been previously successfully {@linkplain #register() registered}, or if it has
 * already been unregistered.
 *
 * @throws JMException if an error occurred during unregistration.
 */
@Configuration
static synchronized void unregister() throws JMException {
    final ObjectName n = name;
    if (n != null) {
        name = null; // Clear even if the next line fail.
        if (n != ObjectName.WILDCARD) {
            ManagementFactory.getPlatformMBeanServer().unregisterMBean(n);
        }
    }
}