mirror of https://github.com/apache/lucene.git
SOLR-2927: Solr does not unregister all mbeans upon exception in constructor causing memory leaks
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1636603 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
35375d57b9
commit
2380e375a0
|
@ -284,6 +284,8 @@ Bug Fixes
|
|||
* SOLR-6631: DistributedQueue spinning on calling zookeeper getChildren()
|
||||
(Jessica Cheng Mallet, Mark Miller, Timothy Potter)
|
||||
|
||||
* SOLR-2927: Solr does not unregister all mbeans upon exception in constructor
|
||||
causing memory leaks. (tom liu, Sharath Babu, Cyrille Roy, shalin)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
|
|
@ -112,8 +112,16 @@ public class JmxMonitoredMap<K, V> extends
|
|||
@Override
|
||||
public void clear() {
|
||||
if (server != null) {
|
||||
for (Map.Entry<String, SolrInfoMBean> entry : entrySet()) {
|
||||
unregister(entry.getKey(), entry.getValue());
|
||||
QueryExp exp = Query.eq(Query.attr("coreHashCode"), Query.value(coreHashCode));
|
||||
Set<ObjectName> objectNames = server.queryNames(null, exp);
|
||||
if (objectNames != null) {
|
||||
for (ObjectName name : objectNames) {
|
||||
try {
|
||||
server.unregisterMBean(name);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Exception un-registering mbean {}", name, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1065,14 +1065,6 @@ public final class SolrCore implements SolrInfoMBean, Closeable {
|
|||
}
|
||||
|
||||
|
||||
try {
|
||||
infoRegistry.clear();
|
||||
} catch (Throwable e) {
|
||||
SolrException.log(log, e);
|
||||
if (e instanceof Error) {
|
||||
throw (Error) e;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (null != updateHandler) {
|
||||
|
@ -1125,6 +1117,15 @@ public final class SolrCore implements SolrInfoMBean, Closeable {
|
|||
throw (Error) e;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
infoRegistry.clear();
|
||||
} catch (Throwable e) {
|
||||
SolrException.log(log, e);
|
||||
if (e instanceof Error) {
|
||||
throw (Error) e;
|
||||
}
|
||||
}
|
||||
|
||||
if (coreStateClosed) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue