accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [3/4] git commit: ACCUMULO-2051 use new getDefaultReplication(Path) if available
Date Fri, 20 Dec 2013 04:10:04 GMT
ACCUMULO-2051 use new getDefaultReplication(Path) if available


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 0d3442831650bd6c70625660e56fc43006ca36e2
Parents: b671fda
Author: Keith Turner <kturner@apache.org>
Authored: Thu Dec 19 21:44:10 2013 -0500
Committer: Keith Turner <kturner@apache.org>
Committed: Thu Dec 19 23:00:02 2013 -0500

----------------------------------------------------------------------
 .../accumulo/server/fs/VolumeManagerImpl.java     | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/0d344283/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java
b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java
index 472b0c0..a89572d 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.server.fs;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.URI;
 import java.util.ArrayList;
@@ -325,8 +326,23 @@ public class VolumeManagerImpl implements VolumeManager {
 
   @Override
   public short getDefaultReplication(Path path) {
+    FileSystem fs = getFileSystemByPath(path);
+    try {
+      // try calling hadoop 2 method
+      Method method = fs.getClass().getMethod("getDefaultReplication", Path.class);
+      return ((Short) method.invoke(fs, path)).shortValue();
+    } catch (NoSuchMethodException e) {
+      // ignore
+    } catch (IllegalArgumentException e) {
+      throw new RuntimeException(e);
+    } catch (IllegalAccessException e) {
+      throw new RuntimeException(e);
+    } catch (InvocationTargetException e) {
+      throw new RuntimeException(e);
+    }
+
     @SuppressWarnings("deprecation")
-    short rep = getFileSystemByPath(path).getDefaultReplication();
+    short rep = fs.getDefaultReplication();
     return rep;
   }
 


Mime
View raw message