SOLR-6918: No need to log exceptions (as warn) generated when creating MBean stats if core is shutting down

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1650123 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy Potter 2015-01-07 17:35:20 +00:00
parent c2712551be
commit 812e0c6e6f
3 changed files with 8 additions and 2 deletions

View File

@ -650,6 +650,9 @@ Other Changes
* SOLR-6830: Update Woodstox to 4.4.1 and StAX to 3.1.4. (ab) * SOLR-6830: Update Woodstox to 4.4.1 and StAX to 3.1.4. (ab)
* SOLR-6918: No need to log exceptions (as warn) generated when creating MBean stats if
the core is shutting down (Timothy Potter)
================== 4.10.3 ================== ================== 4.10.3 ==================
Bug Fixes Bug Fixes

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.solr.core; package org.apache.solr.core;
import org.apache.lucene.store.AlreadyClosedException;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.SolrConfig.JmxConfiguration; import org.apache.solr.core.SolrConfig.JmxConfiguration;
@ -279,6 +280,8 @@ public class JmxMonitoredMap<K, V> extends
} }
} }
} catch (Exception e) { } catch (Exception e) {
// don't log issue if the core is closing
if (!(SolrException.getRootCause(e) instanceof AlreadyClosedException))
LOG.warn("Could not getStatistics on info bean {}", infoBean.getName(), e); LOG.warn("Could not getStatistics on info bean {}", infoBean.getName(), e);
} }

View File

@ -572,7 +572,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
NamedList list = super.getStatistics(); NamedList list = super.getStatistics();
if (core != null) { if (core != null) {
list.add("indexSize", NumberUtils.readableSize(getIndexSize())); list.add("indexSize", NumberUtils.readableSize(getIndexSize()));
CommitVersionInfo vInfo = getIndexVersion(); CommitVersionInfo vInfo = (core != null && !core.isClosed()) ? getIndexVersion(): null;
list.add("indexVersion", null == vInfo ? 0 : vInfo.version); list.add("indexVersion", null == vInfo ? 0 : vInfo.version);
list.add(GENERATION, null == vInfo ? 0 : vInfo.generation); list.add(GENERATION, null == vInfo ? 0 : vInfo.generation);