SOLR-7101: JmxMonitoredMap can throw an exception in clear when queryNames fails.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1659116 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2015-02-12 01:13:21 +00:00
parent 1e0344cd30
commit d0ca43081f
2 changed files with 12 additions and 2 deletions

View File

@ -125,6 +125,9 @@ Bug Fixes
* SOLR-5890: Delete silently fails if not sent to shard where document was
added (Ishan Chattopadhyaya, Noble Paul)
* SOLR-7101: JmxMonitoredMap can throw an exception in clear when queryNames fails.
(Mark Miller, Wolfgang Hoschek)
Optimizations
----------------------
* SOLR-7049: Move work done by the LIST Collections API call to the Collections

View File

@ -117,13 +117,20 @@ public class JmxMonitoredMap<K, V> extends
public void clear() {
if (server != null) {
QueryExp exp = Query.eq(Query.attr("coreHashCode"), Query.value(coreHashCode));
Set<ObjectName> objectNames = server.queryNames(null, exp);
Set<ObjectName> objectNames = null;
try {
objectNames = server.queryNames(null, exp);
} catch (Exception e) {
LOG.warn("Exception querying for mbeans", e);
}
if (objectNames != null) {
for (ObjectName name : objectNames) {
try {
server.unregisterMBean(name);
} catch (Exception e) {
LOG.error("Exception un-registering mbean {}", name, e);
LOG.warn("Exception un-registering mbean {}", name, e);
}
}
}