You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by en...@apache.org on 2013/11/15 23:52:26 UTC

svn commit: r1542425 - in /hbase/trunk: hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterStatusListener.java hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java

Author: enis
Date: Fri Nov 15 22:52:25 2013
New Revision: 1542425

URL: http://svn.apache.org/r1542425
Log:
HBASE-9961 [WINDOWS] Multicast should bind to local address

Modified:
    hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterStatusListener.java
    hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java

Modified: hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterStatusListener.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterStatusListener.java?rev=1542425&r1=1542424&r2=1542425&view=diff
==============================================================================
--- hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterStatusListener.java (original)
+++ hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterStatusListener.java Fri Nov 15 22:52:25 2013
@@ -20,6 +20,18 @@
 package org.apache.hadoop.hbase.client;
 
 
+import java.io.Closeable;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience;
@@ -40,18 +52,6 @@ import org.jboss.netty.channel.socket.Da
 import org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory;
 import org.jboss.netty.handler.codec.protobuf.ProtobufDecoder;
 
-import java.io.Closeable;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
 
 /**
  * A class that receives the cluster status, and provide it as a set of service to the client.
@@ -185,6 +185,7 @@ class ClusterStatusListener implements C
     public MulticastListener() {
     }
 
+    @Override
     public void connect(Configuration conf) throws IOException {
       // Can't be NiO with Netty today => not implemented in Netty.
       DatagramChannelFactory f = new OioDatagramChannelFactory(service);
@@ -196,9 +197,12 @@ class ClusterStatusListener implements C
 
       String mcAddress = conf.get(HConstants.STATUS_MULTICAST_ADDRESS,
           HConstants.DEFAULT_STATUS_MULTICAST_ADDRESS);
+      String bindAddress = conf.get(HConstants.STATUS_MULTICAST_BIND_ADDRESS,
+        HConstants.DEFAULT_STATUS_MULTICAST_BIND_ADDRESS);
       int port = conf.getInt(HConstants.STATUS_MULTICAST_PORT,
           HConstants.DEFAULT_STATUS_MULTICAST_PORT);
-      channel = (DatagramChannel) b.bind(new InetSocketAddress(mcAddress, port));
+
+      channel = (DatagramChannel) b.bind(new InetSocketAddress(bindAddress, port));
 
       channel.getConfig().setReuseAddress(true);
 

Modified: hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java?rev=1542425&r1=1542424&r2=1542425&view=diff
==============================================================================
--- hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java (original)
+++ hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java Fri Nov 15 22:52:25 2013
@@ -298,7 +298,7 @@ public final class HConstants {
    * The directory from which co-processor/custom filter jars can be loaded
    * dynamically by the region servers. This value can be overridden by the
    * hbase.dynamic.jars.dir config.
-   */ 
+   */
   public static final String LIB_DIR = "lib";
 
   /** Used to construct the name of the compaction directory during compaction */
@@ -932,6 +932,14 @@ public final class HConstants {
   public static final String DEFAULT_STATUS_MULTICAST_ADDRESS = "226.1.1.3";
 
   /**
+   * The address to use for binding the local socket for receiving multicast. Defaults to
+   * 0.0.0.0.
+   * @see https://issues.apache.org/jira/browse/HBASE-9961
+   */
+  public static final String STATUS_MULTICAST_BIND_ADDRESS = "hbase.status.multicast.bind.address.ip";
+  public static final String DEFAULT_STATUS_MULTICAST_BIND_ADDRESS = "0.0.0.0";
+
+  /**
    * The port to use for the multicast messages.
    */
   public static final String STATUS_MULTICAST_PORT = "hbase.status.multicast.port";