javax.management.QueryEval Java Examples

The following examples show how to use javax.management.QueryEval. 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 openjdk-8 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 openjdk-jdk9 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 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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
Source File: OldMBeanServerTest.java    From TencentKona-8 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: 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 #12
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 #13
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 #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: 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 #16
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8 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 #17
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 #18
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 #19
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 #20
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-dev-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 #21
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 #22
Source File: ModelControllerMBeanHelper.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**  Set the mbean server on the QueryExp and try and pass back any previously set one */
private static MBeanServer setQueryExpServer(QueryExp query, MBeanServer toSet) {
    // We assume the QueryExp is a QueryEval subclass or uses the QueryEval thread local
    // mechanism to store any existing MBeanServer. If that's not the case we have no
    // way to access the old mbeanserver to let us restore it
    MBeanServer result = QueryEval.getMBeanServer();
    query.setMBeanServer(toSet);
    return result;
}
 
Example #23
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 #24
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 #25
Source File: DefaultMBeanServerInterceptor.java    From openjdk-jdk8u-backup 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 #26
Source File: DefaultMBeanServerInterceptor.java    From TencentKona-8 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 #27
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 #28
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 #29
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 #30
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);
}