HBASE-13564 Master MBeans are not published (Ashish Singhi) + Addendum

This commit is contained in:
stack 2015-04-29 14:36:08 -07:00
parent 36f9546115
commit 07e50f28b1
1 changed files with 13 additions and 5 deletions

View File

@ -51,7 +51,8 @@ public class JMXListener implements Coprocessor {
private static final Log LOG = LogFactory.getLog(JMXListener.class); private static final Log LOG = LogFactory.getLog(JMXListener.class);
public static final String RMI_REGISTRY_PORT_CONF_KEY = ".rmi.registry.port"; public static final String RMI_REGISTRY_PORT_CONF_KEY = ".rmi.registry.port";
public static final String RMI_CONNECTOR_PORT_CONF_KEY = ".rmi.connector.port"; public static final String RMI_CONNECTOR_PORT_CONF_KEY = ".rmi.connector.port";
public static final int defRMIRegistryPort = 10102; public static final int defMasterRMIRegistryPort = 10101;
public static final int defRegionserverRMIRegistryPort = 10102;
/** /**
* workaround for HBASE-11146 * workaround for HBASE-11146
@ -163,11 +164,17 @@ public class JMXListener implements Coprocessor {
Configuration conf = env.getConfiguration(); Configuration conf = env.getConfiguration();
if (env instanceof MasterCoprocessorEnvironment) { if (env instanceof MasterCoprocessorEnvironment) {
LOG.error("JMXListener should not be loaded in Master Environment!"); // running on Master
} else if (env instanceof RegionServerCoprocessorEnvironment) {
// running on RegionServer --since 0.99 HMaster is also a HRegionServer
rmiRegistryPort = rmiRegistryPort =
conf.getInt("regionserver" + RMI_REGISTRY_PORT_CONF_KEY, defRMIRegistryPort); conf.getInt("master" + RMI_REGISTRY_PORT_CONF_KEY, defMasterRMIRegistryPort);
rmiConnectorPort = conf.getInt("master" + RMI_CONNECTOR_PORT_CONF_KEY, rmiRegistryPort);
LOG.info("Master rmiRegistryPort:" + rmiRegistryPort + ",Master rmiConnectorPort:"
+ rmiConnectorPort);
} else if (env instanceof RegionServerCoprocessorEnvironment) {
// running on RegionServer
rmiRegistryPort =
conf.getInt("regionserver" + RMI_REGISTRY_PORT_CONF_KEY,
defRegionserverRMIRegistryPort);
rmiConnectorPort = rmiConnectorPort =
conf.getInt("regionserver" + RMI_CONNECTOR_PORT_CONF_KEY, rmiRegistryPort); conf.getInt("regionserver" + RMI_CONNECTOR_PORT_CONF_KEY, rmiRegistryPort);
LOG.info("RegionServer rmiRegistryPort:" + rmiRegistryPort LOG.info("RegionServer rmiRegistryPort:" + rmiRegistryPort
@ -175,6 +182,7 @@ public class JMXListener implements Coprocessor {
} else if (env instanceof RegionCoprocessorEnvironment) { } else if (env instanceof RegionCoprocessorEnvironment) {
LOG.error("JMXListener should not be loaded in Region Environment!"); LOG.error("JMXListener should not be loaded in Region Environment!");
return;
} }
synchronized(JMXListener.class) { synchronized(JMXListener.class) {