accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From md...@apache.org
Subject [08/10] git commit: Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
Date Tue, 25 Feb 2014 19:53:14 GMT
Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT

Conflicts:
	start/src/main/java/org/apache/accumulo/start/Main.java


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 1d396489d380bc533396a28ae1901e50cbb0f07b
Parents: 0e746a2 6258018
Author: Mike Drob <mdrob@cloudera.com>
Authored: Tue Feb 25 14:47:52 2014 -0500
Committer: Mike Drob <mdrob@cloudera.com>
Committed: Tue Feb 25 14:47:52 2014 -0500

----------------------------------------------------------------------
 .../java/org/apache/accumulo/start/Main.java    | 26 +++++++++++++++++---
 1 file changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/1d396489/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --cc start/src/main/java/org/apache/accumulo/start/Main.java
index ead1e0f,29c47a7..8eadb9d
--- a/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/start/src/main/java/org/apache/accumulo/start/Main.java
@@@ -16,19 -16,17 +16,20 @@@
   */
  package org.apache.accumulo.start;
  
 +import java.io.IOException;
+ import java.lang.reflect.InvocationTargetException;
  import java.lang.reflect.Method;
  import java.lang.reflect.Modifier;
 - 
 +import java.util.jar.Attributes;
 +import java.util.jar.JarFile;
 +
  import org.apache.accumulo.start.classloader.AccumuloClassLoader;
  
  public class Main {
 -  
 +
-   public static void main(String[] args) throws Exception {
+   public static void main(String[] args) {
      Runnable r = null;
 -    
 +
      try {
        if (args.length == 0) {
          printUsage();
@@@ -153,29 -125,19 +159,41 @@@
      }
    }
  
+   /**
+    * Print a stack trace to stderr and exit with a non-zero status.
+    *
+    * @param t
+    *          The {@link Throwable} containing a stack trace to print.
+    */
+   private static void die(Throwable t) {
+     System.err.println("Thread \"" + Thread.currentThread().getName() + "\" died " + t.getMessage());
+     t.printStackTrace(System.err);
+     System.exit(1);
+   }
+ 
    private static void printUsage() {
 -    System.out.println("accumulo init | master | tserver | monitor | shell | admin | gc
| classpath | rfile-info | login-info | tracer | proxy | zookeeper | info | version | <accumulo
class> args");
 +    System.out
 +        .println("accumulo init | master | tserver | monitor | shell | admin | gc | classpath
| rfile-info | login-info | tracer | minicluster | proxy | zookeeper | create-token | info
| version | jar <jar> [<main class>] args | <accumulo class> args");
 +  }
 +
 +  // feature: will work even if main class isn't in the JAR
 +  static Class<?> loadClassFromJar(String[] args, JarFile f, ClassLoader cl) throws
IOException, ClassNotFoundException {
 +    ClassNotFoundException explicitNotFound = null;
 +    if (args.length >= 3) {
 +      try {
 +        return cl.loadClass(args[2]); // jar jar-file main-class
 +      } catch (ClassNotFoundException cnfe) {
 +        // assume this is the first argument, look for main class in JAR manifest
 +        explicitNotFound = cnfe;
 +      }
 +    }
 +    String mainClass = f.getManifest().getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);
 +    if (mainClass == null) {
 +      if (explicitNotFound != null) {
 +        throw explicitNotFound;
 +      }
 +      throw new ClassNotFoundException("No main class was specified, and the JAR manifest
does not specify one");
 +    }
 +    return cl.loadClass(mainClass);
    }
  }


Mime
View raw message