accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [1/2] accumulo git commit: ACCUMULO-3399 Log the error and set the exit value.
Date Wed, 10 Dec 2014 23:03:18 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master 524a81392 -> 67a426277


ACCUMULO-3399 Log the error and set the exit value.


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

Branch: refs/heads/master
Commit: 851583e0f66ccc7223dc211a68ee8d78261a5c9a
Parents: 524a813
Author: Josh Elser <elserj@apache.org>
Authored: Wed Dec 10 16:06:18 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Wed Dec 10 16:06:18 2014 -0500

----------------------------------------------------------------------
 .../examples/simple/client/TracingExample.java  | 23 ++++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/851583e0/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/TracingExample.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/TracingExample.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/TracingExample.java
index 3a010a6..881819b 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/TracingExample.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/TracingExample.java
@@ -34,6 +34,7 @@ import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.trace.DistributedTrace;
+import org.apache.log4j.Logger;
 import org.htrace.Sampler;
 import org.htrace.Trace;
 import org.htrace.TraceScope;
@@ -45,7 +46,7 @@ import com.beust.jcommander.Parameter;
  * 
  */
 public class TracingExample {
-
+  private static final Logger log = Logger.getLogger(TracingExample.class);
   private static final String DEFAULT_TABLE_NAME = "test";
 
   static class Opts extends ClientOnDefaultTable {
@@ -130,14 +131,18 @@ public class TracingExample {
   }
 
   public static void main(String[] args) throws Exception {
-
-    TracingExample tracingExample = new TracingExample();
-    Opts opts = new Opts();
-    ScannerOpts scannerOpts = new ScannerOpts();
-    opts.parseArgs(TracingExample.class.getName(), args, scannerOpts);
-
-    tracingExample.enableTracing(opts);
-    tracingExample.execute(opts);
+    try {
+      TracingExample tracingExample = new TracingExample();
+      Opts opts = new Opts();
+      ScannerOpts scannerOpts = new ScannerOpts();
+      opts.parseArgs(TracingExample.class.getName(), args, scannerOpts);
+
+      tracingExample.enableTracing(opts);
+      tracingExample.execute(opts);
+    } catch (Exception e) {
+      log.error("Caught exception running TraceExample", e);
+      System.exit(1);
+    }
   }
 
 }


Mime
View raw message