accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From md...@apache.org
Subject [1/3] git commit: ACCUMULO-2660 handle invocation ex in dfslogger
Date Fri, 11 Apr 2014 16:37:10 GMT
Repository: accumulo
Updated Branches:
  refs/heads/1.6.0-SNAPSHOT b2008ca92 -> 18fa298e3
  refs/heads/master c9f52faa7 -> 040da03b7


ACCUMULO-2660 handle invocation ex in dfslogger


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 18fa298e30907f12a47266886292904127b7838b
Parents: b2008ca
Author: Mike Drob <mdrob@cloudera.com>
Authored: Fri Apr 11 11:37:41 2014 -0400
Committer: Mike Drob <mdrob@cloudera.com>
Committed: Fri Apr 11 12:36:20 2014 -0400

----------------------------------------------------------------------
 .../apache/accumulo/tserver/log/DfsLogger.java  | 22 +++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/18fa298e/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
index 55df118..c960bd6 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
@@ -26,6 +26,7 @@ import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.nio.channels.ClosedChannelException;
 import java.util.ArrayList;
@@ -456,9 +457,24 @@ public class DfsLogger {
     try {
       write(key, EMPTY);
       sync.invoke(logFile);
-    } catch (Exception ex) {
-      log.error(ex);
-      throw new IOException(ex);
+    } catch (IllegalArgumentException e) {
+      log.error("Signature of sync method changed. Accumulo is likely incompatible with this
version of Hadoop.");
+      throw new RuntimeException(e);
+    } catch (IllegalAccessException e) {
+      log.error("Could not invoke sync method due to permission error.");
+      throw new RuntimeException(e);
+    } catch (InvocationTargetException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof IOException) {
+        throw (IOException) cause;
+      } else if (cause instanceof RuntimeException) {
+        throw (RuntimeException) cause;
+      } else if (cause instanceof Error) {
+        throw (Error) cause;
+      } else {
+        // Cause is null, or some other checked exception that was added later.
+        throw new RuntimeException(e);
+      }
     }
   }
 


Mime
View raw message