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

svn commit: r1545792 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java

Author: tedyu
Date: Tue Nov 26 19:31:12 2013
New Revision: 1545792

URL: http://svn.apache.org/r1545792
Log:
HBASE-10029 Proxy created by HFileSystem#createReorderingProxy() should properly close when connecting to HA namenode


Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java?rev=1545792&r1=1545791&r2=1545792&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java Tue Nov 26 19:31:12 2013
@@ -47,6 +47,7 @@ import org.apache.hadoop.hdfs.protocol.D
 import org.apache.hadoop.hdfs.protocol.LocatedBlock;
 import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
 import org.apache.hadoop.io.Closeable;
+import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.util.Progressable;
 import org.apache.hadoop.util.ReflectionUtils;
 
@@ -262,16 +263,25 @@ public class HFileSystem extends FilterF
             new InvocationHandler() {
               public Object invoke(Object proxy, Method method,
                                    Object[] args) throws Throwable {
-                try { 
-                  Object res = method.invoke(cp, args);
-                  if (res != null && args != null && args.length == 3
-                      && "getBlockLocations".equals(method.getName())
-                      && res instanceof LocatedBlocks
-                      && args[0] instanceof String
-                      && args[0] != null) {
-                    lrb.reorderBlocks(conf, (LocatedBlocks) res, (String) args[0]);
+                try {
+                  if (args.length == 0 && "close".equals(method.getName())) {
+                    if (cp instanceof Closeable) {
+                      ((Closeable)cp).close();
+                    } else {
+                      RPC.stopProxy(cp);
+                    }
+                    return null;
+                  } else {
+                    Object res = method.invoke(cp, args);
+                    if (res != null && args != null && args.length == 3
+                        && "getBlockLocations".equals(method.getName())
+                        && res instanceof LocatedBlocks
+                        && args[0] instanceof String
+                        && args[0] != null) {
+                      lrb.reorderBlocks(conf, (LocatedBlocks) res, (String) args[0]);
+                    }
+                    return res;
                   }
-                  return res;
                 } catch  (InvocationTargetException ite) {
                   // We will have this for all the exception, checked on not, sent
                   //  by any layer, including the functional exception