use of com.sun.jmx.mbeanserver.NamedObject in project jdk8u_jdk by JetBrains.
the class DefaultMBeanServerInterceptor method objectInstancesFromFilteredNamedObjects.
/**
* Applies the specified queries to the set of NamedObjects.
*/
private Set<ObjectInstance> objectInstancesFromFilteredNamedObjects(Set<NamedObject> list, QueryExp query) {
Set<ObjectInstance> result = new HashSet<ObjectInstance>();
// No query ...
if (query == null) {
for (NamedObject no : list) {
final DynamicMBean obj = no.getObject();
final String className = safeGetClassName(obj);
result.add(new ObjectInstance(no.getName(), className));
}
} else {
// Access the filter
MBeanServer oldServer = QueryEval.getMBeanServer();
query.setMBeanServer(server);
try {
for (NamedObject no : list) {
final DynamicMBean obj = no.getObject();
boolean res;
try {
res = query.apply(no.getName());
} catch (Exception e) {
res = false;
}
if (res) {
String className = safeGetClassName(obj);
result.add(new ObjectInstance(no.getName(), className));
}
}
} 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);
}
}
return result;
}
use of com.sun.jmx.mbeanserver.NamedObject in project jdk8u_jdk by JetBrains.
the class DefaultMBeanServerInterceptor method objectNamesFromFilteredNamedObjects.
/**
* Applies the specified queries to the set of NamedObjects.
*/
private Set<ObjectName> objectNamesFromFilteredNamedObjects(Set<NamedObject> list, QueryExp query) {
Set<ObjectName> result = new HashSet<ObjectName>();
// No query ...
if (query == null) {
for (NamedObject no : list) {
result.add(no.getName());
}
} else {
// Access the filter
final MBeanServer oldServer = QueryEval.getMBeanServer();
query.setMBeanServer(server);
try {
for (NamedObject no : list) {
boolean res;
try {
res = query.apply(no.getName());
} catch (Exception e) {
res = false;
}
if (res) {
result.add(no.getName());
}
}
} 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);
}
}
return result;
}
Aggregations