hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-16723 RMI registry is not destroyed after stopping JMX Connector Server (Pankaj Kumar)
Date Thu, 29 Sep 2016 08:58:34 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 96a8e8dce -> d4b5645a4


HBASE-16723 RMI registry is not destroyed after stopping JMX Connector Server (Pankaj Kumar)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/d4b5645a
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/d4b5645a
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/d4b5645a

Branch: refs/heads/branch-1
Commit: d4b5645a4ea5674fa5be7f870d9d14d596077d40
Parents: 96a8e8d
Author: tedyu <yuzhihong@gmail.com>
Authored: Thu Sep 29 01:58:22 2016 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Thu Sep 29 01:58:22 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/JMXListener.java  | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/d4b5645a/hbase-server/src/main/java/org/apache/hadoop/hbase/JMXListener.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/JMXListener.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/JMXListener.java
index 2872cfa..9265fb8 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/JMXListener.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/JMXListener.java
@@ -27,8 +27,10 @@ import org.apache.hadoop.hbase.coprocessor.*;
 import java.io.IOException;
 import java.lang.management.ManagementFactory;
 import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
 import java.rmi.server.RMIClientSocketFactory;
 import java.rmi.server.RMIServerSocketFactory;
+import java.rmi.server.UnicastRemoteObject;
 import java.util.HashMap;
 
 import javax.management.MBeanServer;
@@ -36,8 +38,6 @@ import javax.management.remote.JMXConnectorServer;
 import javax.management.remote.JMXConnectorServerFactory;
 import javax.management.remote.JMXServiceURL;
 import javax.management.remote.rmi.RMIConnectorServer;
-import javax.rmi.ssl.SslRMIClientSocketFactory;
-import javax.rmi.ssl.SslRMIServerSocketFactory;
 
 /**
  * Pluggable JMX Agent for HBase(to fix the 2 random TCP ports issue
@@ -61,6 +61,7 @@ public class JMXListener implements Coprocessor {
    * we only load regionserver coprocessor on master
    */
   private static JMXConnectorServer JMX_CS = null;
+  private Registry rmiRegistry = null;
 
   public static JMXServiceURL buildJMXServiceURL(int rmiRegistryPort,
       int rmiConnectorPort) throws IOException {
@@ -128,7 +129,7 @@ public class JMXListener implements Coprocessor {
     }
 
     // Create the RMI registry
-    LocateRegistry.createRegistry(rmiRegistryPort);
+    rmiRegistry = LocateRegistry.createRegistry(rmiRegistryPort);
     // Retrieve the PlatformMBeanServer.
     MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
 
@@ -147,17 +148,25 @@ public class JMXListener implements Coprocessor {
       LOG.info("ConnectorServer started!");
     } catch (IOException e) {
       LOG.error("fail to start connector server!", e);
+      // deregister the RMI registry
+      if (rmiRegistry != null) {
+        UnicastRemoteObject.unexportObject(rmiRegistry, true);
+      }
     }
 
   }
 
   public void stopConnectorServer() throws IOException {
-    synchronized(JMXListener.class) {
+    synchronized (JMXListener.class) {
       if (JMX_CS != null) {
         JMX_CS.stop();
         LOG.info("ConnectorServer stopped!");
         JMX_CS = null;
       }
+      // deregister the RMI registry
+      if (rmiRegistry != null) {
+        UnicastRemoteObject.unexportObject(rmiRegistry, true);
+      }
     }
   }
 


Mime
View raw message