mirror of https://github.com/apache/lucene.git
SOLR-1843: new rootName attribute for <jmx /> configuration ... allows users to override the top level name for MBeans when exposed via JMX.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@942292 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f3c25f02d5
commit
003cc244f8
|
@ -170,6 +170,12 @@ Optimizations
|
|||
* SOLR-1904: When facet.enum.cache.minDf > 0 and the base doc set is a
|
||||
SortedIntSet, convert to HashDocSet for better performance. (yonik)
|
||||
|
||||
* SOLR-1843: A new "rootName" attribute is now available when
|
||||
configuring <jmx/> in solrconfig.xml. If this attribute is set,
|
||||
Solr will use it as the root name for all MBeans Solr exposes via
|
||||
JMX. The default root name is "solr" followed by the core name.
|
||||
(Constantijn Visinescu, hossman)
|
||||
|
||||
Bug Fixes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -53,15 +53,12 @@ public class JmxMonitoredMap<K, V> extends
|
|||
|
||||
private String jmxRootName;
|
||||
|
||||
public JmxMonitoredMap(String coreName, JmxConfiguration jmxConfig) {
|
||||
jmxRootName = "solr" + (coreName == null ? "" : "/" + coreName);
|
||||
|
||||
if (jmxConfig.agentId != null && jmxConfig.serviceUrl != null) {
|
||||
throw new SolrException(
|
||||
SolrException.ErrorCode.SERVER_ERROR,
|
||||
"Incorrect JMX Configuration in solrconfig.xml, both agentId and serviceUrl cannot be specified at the same time");
|
||||
}
|
||||
|
||||
public JmxMonitoredMap(final String coreName,
|
||||
final JmxConfiguration jmxConfig) {
|
||||
jmxRootName = (null != jmxConfig.rootName ?
|
||||
jmxConfig.rootName
|
||||
: ("solr" + (null != coreName ? "/" + coreName : "")));
|
||||
|
||||
if (jmxConfig.serviceUrl == null) {
|
||||
List<MBeanServer> servers = null;
|
||||
|
||||
|
@ -78,13 +75,12 @@ public class JmxMonitoredMap<K, V> extends
|
|||
}
|
||||
|
||||
if (servers == null || servers.isEmpty()) {
|
||||
LOG
|
||||
.info("No JMX servers found, not exposing Solr information with JMX.");
|
||||
LOG.info("No JMX servers found, not exposing Solr information with JMX.");
|
||||
return;
|
||||
}
|
||||
server = servers.get(0);
|
||||
LOG.info("JMX monitoring is enabled. Adding Solr mbeans to JMX Server: "
|
||||
+ server);
|
||||
+ server);
|
||||
} else {
|
||||
try {
|
||||
// Create a new MBeanServer with the given serviceUrl
|
||||
|
|
|
@ -179,10 +179,13 @@ public class SolrConfig extends Config {
|
|||
|
||||
Node jmx = (Node) getNode("jmx", false);
|
||||
if (jmx != null) {
|
||||
jmxConfig = new JmxConfiguration(true, get("jmx/@agentId", null), get(
|
||||
"jmx/@serviceUrl", null));
|
||||
jmxConfig = new JmxConfiguration(true,
|
||||
get("jmx/@agentId", null),
|
||||
get("jmx/@serviceUrl", null),
|
||||
get("jmx/@rootName", null));
|
||||
|
||||
} else {
|
||||
jmxConfig = new JmxConfiguration(false, null, null);
|
||||
jmxConfig = new JmxConfiguration(false, null, null, null);
|
||||
}
|
||||
maxWarmingSearchers = getInt("query/maxWarmingSearchers",Integer.MAX_VALUE);
|
||||
|
||||
|
@ -319,15 +322,32 @@ public class SolrConfig extends Config {
|
|||
|
||||
public static class JmxConfiguration {
|
||||
public boolean enabled = false;
|
||||
|
||||
public String agentId;
|
||||
|
||||
public String serviceUrl;
|
||||
public String rootName;
|
||||
|
||||
public JmxConfiguration(boolean enabled, String agentId, String serviceUrl) {
|
||||
@Deprecated
|
||||
public JmxConfiguration(boolean enabled,
|
||||
String agentId,
|
||||
String serviceUrl) {
|
||||
this(enabled,agentId,serviceUrl,null);
|
||||
}
|
||||
public JmxConfiguration(boolean enabled,
|
||||
String agentId,
|
||||
String serviceUrl,
|
||||
String rootName) {
|
||||
this.enabled = enabled;
|
||||
this.agentId = agentId;
|
||||
this.serviceUrl = serviceUrl;
|
||||
this.rootName = rootName;
|
||||
|
||||
if (agentId != null && serviceUrl != null) {
|
||||
throw new SolrException
|
||||
(SolrException.ErrorCode.SERVER_ERROR,
|
||||
"Incorrect JMX Configuration in solrconfig.xml, "+
|
||||
"both agentId and serviceUrl cannot be specified at the same time");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue