Java Code Examples for javax.management.QueryEval#getMBeanServer()

The following examples show how to use javax.management.QueryEval#getMBeanServer() . 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: 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 2
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 3
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 4
Source File: OldMBeanServerTest.java    From openjdk-jdk8u 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: DefaultMBeanServerInterceptor.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the specified queries to the set of ObjectInstances.
 */
private Set<ObjectInstance>
        filterListOfObjectInstances(Set<ObjectInstance> list,
                                    QueryExp query) {
    // Null query.
    //
    if (query == null) {
        return list;
    } else {
        Set<ObjectInstance> result = new HashSet<ObjectInstance>();
        // Access the filter.
        //
        for (ObjectInstance oi : list) {
            boolean res = false;
            MBeanServer oldServer = QueryEval.getMBeanServer();
            query.setMBeanServer(server);
            try {
                res = query.apply(oi.getObjectName());
            } catch (Exception e) {
                res = false;
            } finally {
                /*
                 * query.setMBeanServer is probably
                 * QueryEval.setMBeanServer so put back the old
                 * value.  Since that method uses a ThreadLocal
                 * variable, this code is only needed for the
                 * unusual case where the user creates a custom
                 * QueryExp that calls a nested query on another
                 * MBeanServer.
                 */
                query.setMBeanServer(oldServer);
            }
            if (res) {
                result.add(oi);
            }
        }
        return result;
    }
}
 
Example 6
Source File: DefaultMBeanServerInterceptor.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the specified queries to the set of ObjectInstances.
 */
private Set<ObjectInstance>
        filterListOfObjectInstances(Set<ObjectInstance> list,
                                    QueryExp query) {
    // Null query.
    //
    if (query == null) {
        return list;
    } else {
        Set<ObjectInstance> result = new HashSet<ObjectInstance>();
        // Access the filter.
        //
        for (ObjectInstance oi : list) {
            boolean res = false;
            MBeanServer oldServer = QueryEval.getMBeanServer();
            query.setMBeanServer(server);
            try {
                res = query.apply(oi.getObjectName());
            } catch (Exception e) {
                res = false;
            } finally {
                /*
                 * query.setMBeanServer is probably
                 * QueryEval.setMBeanServer so put back the old
                 * value.  Since that method uses a ThreadLocal
                 * variable, this code is only needed for the
                 * unusual case where the user creates a custom
                 * QueryExp that calls a nested query on another
                 * MBeanServer.
                 */
                query.setMBeanServer(oldServer);
            }
            if (res) {
                result.add(oi);
            }
        }
        return result;
    }
}
 
Example 7
Source File: DefaultMBeanServerInterceptor.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the specified queries to the set of ObjectInstances.
 */
private Set<ObjectInstance>
        filterListOfObjectInstances(Set<ObjectInstance> list,
                                    QueryExp query) {
    // Null query.
    //
    if (query == null) {
        return list;
    } else {
        Set<ObjectInstance> result = new HashSet<ObjectInstance>();
        // Access the filter.
        //
        for (ObjectInstance oi : list) {
            boolean res = false;
            MBeanServer oldServer = QueryEval.getMBeanServer();
            query.setMBeanServer(server);
            try {
                res = query.apply(oi.getObjectName());
            } catch (Exception e) {
                res = false;
            } finally {
                /*
                 * query.setMBeanServer is probably
                 * QueryEval.setMBeanServer so put back the old
                 * value.  Since that method uses a ThreadLocal
                 * variable, this code is only needed for the
                 * unusual case where the user creates a custom
                 * QueryExp that calls a nested query on another
                 * MBeanServer.
                 */
                query.setMBeanServer(oldServer);
            }
            if (res) {
                result.add(oi);
            }
        }
        return result;
    }
}
 
Example 8
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the specified queries to the set of ObjectInstances.
 */
private Set<ObjectInstance>
        filterListOfObjectInstances(Set<ObjectInstance> list,
                                    QueryExp query) {
    // Null query.
    //
    if (query == null) {
        return list;
    } else {
        Set<ObjectInstance> result = new HashSet<ObjectInstance>();
        // Access the filter.
        //
        for (ObjectInstance oi : list) {
            boolean res = false;
            MBeanServer oldServer = QueryEval.getMBeanServer();
            query.setMBeanServer(server);
            try {
                res = query.apply(oi.getObjectName());
            } catch (Exception e) {
                res = false;
            } finally {
                /*
                 * query.setMBeanServer is probably
                 * QueryEval.setMBeanServer so put back the old
                 * value.  Since that method uses a ThreadLocal
                 * variable, this code is only needed for the
                 * unusual case where the user creates a custom
                 * QueryExp that calls a nested query on another
                 * MBeanServer.
                 */
                query.setMBeanServer(oldServer);
            }
            if (res) {
                result.add(oi);
            }
        }
        return result;
    }
}
 
Example 9
Source File: DefaultMBeanServerInterceptor.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the specified queries to the set of ObjectInstances.
 */
private Set<ObjectInstance>
        filterListOfObjectInstances(Set<ObjectInstance> list,
                                    QueryExp query) {
    // Null query.
    //
    if (query == null) {
        return list;
    } else {
        Set<ObjectInstance> result = new HashSet<ObjectInstance>();
        // Access the filter.
        //
        for (ObjectInstance oi : list) {
            boolean res = false;
            MBeanServer oldServer = QueryEval.getMBeanServer();
            query.setMBeanServer(server);
            try {
                res = query.apply(oi.getObjectName());
            } catch (Exception e) {
                res = false;
            } finally {
                /*
                 * query.setMBeanServer is probably
                 * QueryEval.setMBeanServer so put back the old
                 * value.  Since that method uses a ThreadLocal
                 * variable, this code is only needed for the
                 * unusual case where the user creates a custom
                 * QueryExp that calls a nested query on another
                 * MBeanServer.
                 */
                query.setMBeanServer(oldServer);
            }
            if (res) {
                result.add(oi);
            }
        }
        return result;
    }
}
 
Example 10
Source File: DefaultMBeanServerInterceptor.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Applies the specified queries to the set of ObjectInstances.
 */
private Set<ObjectInstance>
        filterListOfObjectInstances(Set<ObjectInstance> list,
                                    QueryExp query) {
    // Null query.
    //
    if (query == null) {
        return list;
    } else {
        Set<ObjectInstance> result = new HashSet<ObjectInstance>();
        // Access the filter.
        //
        for (ObjectInstance oi : list) {
            boolean res = false;
            MBeanServer oldServer = QueryEval.getMBeanServer();
            query.setMBeanServer(server);
            try {
                res = query.apply(oi.getObjectName());
            } catch (Exception e) {
                res = false;
            } finally {
                /*
                 * query.setMBeanServer is probably
                 * QueryEval.setMBeanServer so put back the old
                 * value.  Since that method uses a ThreadLocal
                 * variable, this code is only needed for the
                 * unusual case where the user creates a custom
                 * QueryExp that calls a nested query on another
                 * MBeanServer.
                 */
                query.setMBeanServer(oldServer);
            }
            if (res) {
                result.add(oi);
            }
        }
        return result;
    }
}
 
Example 11
Source File: DefaultMBeanServerInterceptor.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Applies the specified queries to the set of ObjectInstances.
 */
private Set<ObjectInstance>
        filterListOfObjectInstances(Set<ObjectInstance> list,
                                    QueryExp query) {
    // Null query.
    //
    if (query == null) {
        return list;
    } else {
        Set<ObjectInstance> result = new HashSet<ObjectInstance>();
        // Access the filter.
        //
        for (ObjectInstance oi : list) {
            boolean res = false;
            MBeanServer oldServer = QueryEval.getMBeanServer();
            query.setMBeanServer(server);
            try {
                res = query.apply(oi.getObjectName());
            } catch (Exception e) {
                res = false;
            } finally {
                /*
                 * query.setMBeanServer is probably
                 * QueryEval.setMBeanServer so put back the old
                 * value.  Since that method uses a ThreadLocal
                 * variable, this code is only needed for the
                 * unusual case where the user creates a custom
                 * QueryExp that calls a nested query on another
                 * MBeanServer.
                 */
                query.setMBeanServer(oldServer);
            }
            if (res) {
                result.add(oi);
            }
        }
        return result;
    }
}
 
Example 12
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the specified queries to the set of ObjectInstances.
 */
private Set<ObjectInstance>
        filterListOfObjectInstances(Set<ObjectInstance> list,
                                    QueryExp query) {
    // Null query.
    //
    if (query == null) {
        return list;
    } else {
        Set<ObjectInstance> result = new HashSet<ObjectInstance>();
        // Access the filter.
        //
        for (ObjectInstance oi : list) {
            boolean res = false;
            MBeanServer oldServer = QueryEval.getMBeanServer();
            query.setMBeanServer(server);
            try {
                res = query.apply(oi.getObjectName());
            } catch (Exception e) {
                res = false;
            } finally {
                /*
                 * query.setMBeanServer is probably
                 * QueryEval.setMBeanServer so put back the old
                 * value.  Since that method uses a ThreadLocal
                 * variable, this code is only needed for the
                 * unusual case where the user creates a custom
                 * QueryExp that calls a nested query on another
                 * MBeanServer.
                 */
                query.setMBeanServer(oldServer);
            }
            if (res) {
                result.add(oi);
            }
        }
        return result;
    }
}
 
Example 13
Source File: DefaultMBeanServerInterceptor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the specified queries to the set of ObjectInstances.
 */
private Set<ObjectInstance>
        filterListOfObjectInstances(Set<ObjectInstance> list,
                                    QueryExp query) {
    // Null query.
    //
    if (query == null) {
        return list;
    } else {
        Set<ObjectInstance> result = new HashSet<ObjectInstance>();
        // Access the filter.
        //
        for (ObjectInstance oi : list) {
            boolean res = false;
            MBeanServer oldServer = QueryEval.getMBeanServer();
            query.setMBeanServer(server);
            try {
                res = query.apply(oi.getObjectName());
            } catch (Exception e) {
                res = false;
            } finally {
                /*
                 * query.setMBeanServer is probably
                 * QueryEval.setMBeanServer so put back the old
                 * value.  Since that method uses a ThreadLocal
                 * variable, this code is only needed for the
                 * unusual case where the user creates a custom
                 * QueryExp that calls a nested query on another
                 * MBeanServer.
                 */
                query.setMBeanServer(oldServer);
            }
            if (res) {
                result.add(oi);
            }
        }
        return result;
    }
}
 
Example 14
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the specified queries to the set of ObjectInstances.
 */
private Set<ObjectInstance>
        filterListOfObjectInstances(Set<ObjectInstance> list,
                                    QueryExp query) {
    // Null query.
    //
    if (query == null) {
        return list;
    } else {
        Set<ObjectInstance> result = new HashSet<ObjectInstance>();
        // Access the filter.
        //
        for (ObjectInstance oi : list) {
            boolean res = false;
            MBeanServer oldServer = QueryEval.getMBeanServer();
            query.setMBeanServer(server);
            try {
                res = query.apply(oi.getObjectName());
            } catch (Exception e) {
                res = false;
            } finally {
                /*
                 * query.setMBeanServer is probably
                 * QueryEval.setMBeanServer so put back the old
                 * value.  Since that method uses a ThreadLocal
                 * variable, this code is only needed for the
                 * unusual case where the user creates a custom
                 * QueryExp that calls a nested query on another
                 * MBeanServer.
                 */
                query.setMBeanServer(oldServer);
            }
            if (res) {
                result.add(oi);
            }
        }
        return result;
    }
}
 
Example 15
Source File: ArrayNotificationBuffer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public boolean apply(final ObjectName name) {
    final MBeanServer mbs = QueryEval.getMBeanServer();
    return isInstanceOf(mbs, name, broadcasterClass);
}
 
Example 16
Source File: ArrayNotificationBuffer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public boolean apply(final ObjectName name) {
    final MBeanServer mbs = QueryEval.getMBeanServer();
    return isInstanceOf(mbs, name, broadcasterClass);
}
 
Example 17
Source File: ArrayNotificationBuffer.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public boolean apply(final ObjectName name) {
    final MBeanServer mbs = QueryEval.getMBeanServer();
    return isInstanceOf(mbs, name, broadcasterClass);
}
 
Example 18
Source File: ArrayNotificationBuffer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public boolean apply(final ObjectName name) {
    final MBeanServer mbs = QueryEval.getMBeanServer();
    return isInstanceOf(mbs, name, broadcasterClass);
}
 
Example 19
Source File: ArrayNotificationBuffer.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public boolean apply(final ObjectName name) {
    final MBeanServer mbs = QueryEval.getMBeanServer();
    return isInstanceOf(mbs, name, broadcasterClass);
}
 
Example 20
Source File: ArrayNotificationBuffer.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public boolean apply(final ObjectName name) {
    final MBeanServer mbs = QueryEval.getMBeanServer();
    return isInstanceOf(mbs, name, broadcasterClass);
}