You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2016/11/01 19:48:24 UTC

[46/50] hbase git commit: HBASE-16723 RMI registry is not destroyed after stopping JMX Connector Server

HBASE-16723 RMI registry is not destroyed after stopping JMX Connector Server

Signed-off-by: Ashish Singhi <as...@apache.org>


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

Branch: refs/heads/0.98
Commit: 0cd6fce9df62fae3388222045c8335e60e3f558a
Parents: 44c724b
Author: Pankaj Kumar <pa...@huawei.com>
Authored: Fri Oct 7 12:24:02 2016 +0530
Committer: Ashish Singhi <as...@apache.org>
Committed: Fri Oct 7 12:24:02 2016 +0530

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/JMXListener.java    | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0cd6fce9/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 eb6445c..3f41e2d 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
@@ -55,6 +55,7 @@ public class JMXListener implements Coprocessor {
   public static final int defRegionserverRMIRegistryPort = 10102;
 
   private JMXConnectorServer jmxCS = null;
+  private Registry rmiRegistry = null;
 
   public static JMXServiceURL buildJMXServiceURL(int rmiRegistryPort,
       int rmiConnectorPort) throws IOException {
@@ -122,7 +123,7 @@ public class JMXListener implements Coprocessor {
     }
 
     // Create the RMI registry
-    LocateRegistry.createRegistry(rmiRegistryPort);
+    rmiRegistry = LocateRegistry.createRegistry(rmiRegistryPort);
     // Retrieve the PlatformMBeanServer.
     MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
 
@@ -136,6 +137,10 @@ 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);
+      }
     }
 
   }
@@ -146,6 +151,10 @@ public class JMXListener implements Coprocessor {
       LOG.info("ConnectorServer stopped!");
       jmxCS = null;
     }
+    // deregister the RMI registry
+    if (rmiRegistry != null) {
+      UnicastRemoteObject.unexportObject(rmiRegistry, true);
+    }
   }