You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by md...@apache.org on 2014/02/25 20:53:07 UTC
[01/10] git commit: ACCUMULO-2404 Better error logging in start.Main
Repository: accumulo
Updated Branches:
refs/heads/1.4.5-SNAPSHOT 282942661 -> 1543d65fb
refs/heads/1.5.1-SNAPSHOT 7e106a21a -> 625801848
refs/heads/1.6.0-SNAPSHOT 0e746a29a -> 1d396489d
refs/heads/master 133609939 -> 6083fbca5
ACCUMULO-2404 Better error logging in start.Main
Propogate original exceptions instead of the wrapping
InvocationTargetException when possible, when starting processes
through o.a.a.start.Main
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1543d65f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1543d65f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1543d65f
Branch: refs/heads/1.4.5-SNAPSHOT
Commit: 1543d65fb2ff54ede7785f591f30f3764622b4df
Parents: 2829426
Author: Mike Drob <md...@cloudera.com>
Authored: Tue Feb 25 11:41:51 2014 -0500
Committer: Mike Drob <md...@cloudera.com>
Committed: Tue Feb 25 11:41:51 2014 -0500
----------------------------------------------------------------------
.../java/org/apache/accumulo/start/Main.java | 34 +++++++++++++++-----
1 file changed, 26 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/1543d65f/src/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --git a/src/start/src/main/java/org/apache/accumulo/start/Main.java b/src/start/src/main/java/org/apache/accumulo/start/Main.java
index 53c31a5..f955dd8 100644
--- a/src/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/src/start/src/main/java/org/apache/accumulo/start/Main.java
@@ -16,14 +16,15 @@
*/
package org.apache.accumulo.start;
-import org.apache.accumulo.start.classloader.AccumuloClassLoader;
-
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+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 {
@@ -89,10 +90,15 @@ public class Main {
public void run() {
try {
finalMain.invoke(null, thisIsJustOneArgument);
+ } catch (InvocationTargetException e) {
+ if (e.getCause() != null) {
+ die(e.getCause());
+ } else {
+ // Should never happen, but check anyway.
+ die(e);
+ }
} catch (Exception e) {
- System.err.println("Thread \"" + Thread.currentThread().getName() + "\" died " + e.getMessage());
- e.printStackTrace(System.err);
- System.exit(1);
+ die(e);
}
}
};
@@ -105,7 +111,19 @@ public class Main {
t.printStackTrace(System.err);
}
}
-
+
+ /**
+ * 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 | logger | monitor | shell | admin | gc | classpath | <accumulo class> args");
}
[04/10] git commit: ACCUMULO-2404 Better error logging in start.Main
Posted by md...@apache.org.
ACCUMULO-2404 Better error logging in start.Main
Propogate original exceptions instead of the wrapping
InvocationTargetException when possible, when starting processes
through o.a.a.start.Main
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1543d65f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1543d65f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1543d65f
Branch: refs/heads/master
Commit: 1543d65fb2ff54ede7785f591f30f3764622b4df
Parents: 2829426
Author: Mike Drob <md...@cloudera.com>
Authored: Tue Feb 25 11:41:51 2014 -0500
Committer: Mike Drob <md...@cloudera.com>
Committed: Tue Feb 25 11:41:51 2014 -0500
----------------------------------------------------------------------
.../java/org/apache/accumulo/start/Main.java | 34 +++++++++++++++-----
1 file changed, 26 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/1543d65f/src/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --git a/src/start/src/main/java/org/apache/accumulo/start/Main.java b/src/start/src/main/java/org/apache/accumulo/start/Main.java
index 53c31a5..f955dd8 100644
--- a/src/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/src/start/src/main/java/org/apache/accumulo/start/Main.java
@@ -16,14 +16,15 @@
*/
package org.apache.accumulo.start;
-import org.apache.accumulo.start.classloader.AccumuloClassLoader;
-
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+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 {
@@ -89,10 +90,15 @@ public class Main {
public void run() {
try {
finalMain.invoke(null, thisIsJustOneArgument);
+ } catch (InvocationTargetException e) {
+ if (e.getCause() != null) {
+ die(e.getCause());
+ } else {
+ // Should never happen, but check anyway.
+ die(e);
+ }
} catch (Exception e) {
- System.err.println("Thread \"" + Thread.currentThread().getName() + "\" died " + e.getMessage());
- e.printStackTrace(System.err);
- System.exit(1);
+ die(e);
}
}
};
@@ -105,7 +111,19 @@ public class Main {
t.printStackTrace(System.err);
}
}
-
+
+ /**
+ * 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 | logger | monitor | shell | admin | gc | classpath | <accumulo class> args");
}
[08/10] git commit: Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
Posted by md...@apache.org.
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 <md...@cloudera.com>
Authored: Tue Feb 25 14:47:52 2014 -0500
Committer: Mike Drob <md...@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);
}
}
[03/10] git commit: ACCUMULO-2404 Better error logging in start.Main
Posted by md...@apache.org.
ACCUMULO-2404 Better error logging in start.Main
Propogate original exceptions instead of the wrapping
InvocationTargetException when possible, when starting processes
through o.a.a.start.Main
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1543d65f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1543d65f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1543d65f
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 1543d65fb2ff54ede7785f591f30f3764622b4df
Parents: 2829426
Author: Mike Drob <md...@cloudera.com>
Authored: Tue Feb 25 11:41:51 2014 -0500
Committer: Mike Drob <md...@cloudera.com>
Committed: Tue Feb 25 11:41:51 2014 -0500
----------------------------------------------------------------------
.../java/org/apache/accumulo/start/Main.java | 34 +++++++++++++++-----
1 file changed, 26 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/1543d65f/src/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --git a/src/start/src/main/java/org/apache/accumulo/start/Main.java b/src/start/src/main/java/org/apache/accumulo/start/Main.java
index 53c31a5..f955dd8 100644
--- a/src/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/src/start/src/main/java/org/apache/accumulo/start/Main.java
@@ -16,14 +16,15 @@
*/
package org.apache.accumulo.start;
-import org.apache.accumulo.start.classloader.AccumuloClassLoader;
-
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+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 {
@@ -89,10 +90,15 @@ public class Main {
public void run() {
try {
finalMain.invoke(null, thisIsJustOneArgument);
+ } catch (InvocationTargetException e) {
+ if (e.getCause() != null) {
+ die(e.getCause());
+ } else {
+ // Should never happen, but check anyway.
+ die(e);
+ }
} catch (Exception e) {
- System.err.println("Thread \"" + Thread.currentThread().getName() + "\" died " + e.getMessage());
- e.printStackTrace(System.err);
- System.exit(1);
+ die(e);
}
}
};
@@ -105,7 +111,19 @@ public class Main {
t.printStackTrace(System.err);
}
}
-
+
+ /**
+ * 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 | logger | monitor | shell | admin | gc | classpath | <accumulo class> args");
}
[10/10] git commit: Merge branch '1.6.0-SNAPSHOT'
Posted by md...@apache.org.
Merge branch '1.6.0-SNAPSHOT'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/6083fbca
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/6083fbca
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/6083fbca
Branch: refs/heads/master
Commit: 6083fbca5d2ba2f8ce3337e4d33111ca07cc1eb7
Parents: 1336099 1d39648
Author: Mike Drob <md...@cloudera.com>
Authored: Tue Feb 25 14:52:26 2014 -0500
Committer: Mike Drob <md...@cloudera.com>
Committed: Tue Feb 25 14:52:26 2014 -0500
----------------------------------------------------------------------
.../java/org/apache/accumulo/start/Main.java | 26 +++++++++++++++++---
1 file changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
[02/10] git commit: ACCUMULO-2404 Better error logging in start.Main
Posted by md...@apache.org.
ACCUMULO-2404 Better error logging in start.Main
Propogate original exceptions instead of the wrapping
InvocationTargetException when possible, when starting processes
through o.a.a.start.Main
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1543d65f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1543d65f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1543d65f
Branch: refs/heads/1.5.1-SNAPSHOT
Commit: 1543d65fb2ff54ede7785f591f30f3764622b4df
Parents: 2829426
Author: Mike Drob <md...@cloudera.com>
Authored: Tue Feb 25 11:41:51 2014 -0500
Committer: Mike Drob <md...@cloudera.com>
Committed: Tue Feb 25 11:41:51 2014 -0500
----------------------------------------------------------------------
.../java/org/apache/accumulo/start/Main.java | 34 +++++++++++++++-----
1 file changed, 26 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/1543d65f/src/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --git a/src/start/src/main/java/org/apache/accumulo/start/Main.java b/src/start/src/main/java/org/apache/accumulo/start/Main.java
index 53c31a5..f955dd8 100644
--- a/src/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/src/start/src/main/java/org/apache/accumulo/start/Main.java
@@ -16,14 +16,15 @@
*/
package org.apache.accumulo.start;
-import org.apache.accumulo.start.classloader.AccumuloClassLoader;
-
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+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 {
@@ -89,10 +90,15 @@ public class Main {
public void run() {
try {
finalMain.invoke(null, thisIsJustOneArgument);
+ } catch (InvocationTargetException e) {
+ if (e.getCause() != null) {
+ die(e.getCause());
+ } else {
+ // Should never happen, but check anyway.
+ die(e);
+ }
} catch (Exception e) {
- System.err.println("Thread \"" + Thread.currentThread().getName() + "\" died " + e.getMessage());
- e.printStackTrace(System.err);
- System.exit(1);
+ die(e);
}
}
};
@@ -105,7 +111,19 @@ public class Main {
t.printStackTrace(System.err);
}
}
-
+
+ /**
+ * 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 | logger | monitor | shell | admin | gc | classpath | <accumulo class> args");
}
[07/10] git commit: Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT
Posted by md...@apache.org.
Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT
Conflicts:
src/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/62580184
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/62580184
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/62580184
Branch: refs/heads/master
Commit: 625801848cbb93ac0240eecf09ce62f225ee0960
Parents: 7e106a2 1543d65
Author: Mike Drob <md...@cloudera.com>
Authored: Tue Feb 25 14:38:25 2014 -0500
Committer: Mike Drob <md...@cloudera.com>
Committed: Tue Feb 25 14:38:25 2014 -0500
----------------------------------------------------------------------
.../java/org/apache/accumulo/start/Main.java | 30 ++++++++++++++++----
1 file changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/62580184/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --cc start/src/main/java/org/apache/accumulo/start/Main.java
index cbc90c6,0000000..29c47a7
mode 100644,000000..100644
--- a/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/start/src/main/java/org/apache/accumulo/start/Main.java
@@@ -1,125 -1,0 +1,143 @@@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.start;
+
++import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
-
++
+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();
+ System.exit(1);
+ }
+ final String argsToPass[] = new String[args.length - 1];
+ System.arraycopy(args, 1, argsToPass, 0, args.length - 1);
+
+ Thread.currentThread().setContextClassLoader(AccumuloClassLoader.getClassLoader());
+
+ Class<?> vfsClassLoader = AccumuloClassLoader.getClassLoader().loadClass("org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader");
+
+ ClassLoader cl = (ClassLoader) vfsClassLoader.getMethod("getClassLoader", new Class[] {}).invoke(null, new Object[] {});
+
+ Class<?> runTMP = null;
+
+ Thread.currentThread().setContextClassLoader(cl);
+
+ if (args[0].equals("master")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.master.Master");
+ } else if (args[0].equals("tserver")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.tabletserver.TabletServer");
+ } else if (args[0].equals("shell")) {
+ runTMP = cl.loadClass("org.apache.accumulo.core.util.shell.Shell");
+ } else if (args[0].equals("init")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.Initialize");
+ } else if (args[0].equals("admin")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.Admin");
+ } else if (args[0].equals("gc")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.gc.SimpleGarbageCollector");
+ } else if (args[0].equals("monitor")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.monitor.Monitor");
+ } else if (args[0].equals("tracer")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.trace.TraceServer");
+ } else if (args[0].equals("proxy")) {
+ runTMP = cl.loadClass("org.apache.accumulo.proxy.Proxy");
+ } else if (args[0].equals("classpath")) {
+ vfsClassLoader.getMethod("printClassPath", new Class[] {}).invoke(vfsClassLoader, new Object[] {});
+ return;
+ } else if (args[0].equals("version")) {
+ runTMP = cl.loadClass("org.apache.accumulo.core.Constants");
+ System.out.println(runTMP.getField("VERSION").get(null));
+ return;
+ } else if (args[0].equals("rfile-info")) {
+ runTMP = cl.loadClass("org.apache.accumulo.core.file.rfile.PrintInfo");
+ } else if (args[0].equals("login-info")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.LoginProperties");
+ } else if (args[0].equals("zookeeper")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.ZooKeeperMain");
+ } else if (args[0].equals("info")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.Info");
+ } else {
+ try {
+ runTMP = cl.loadClass(args[0]);
+ } catch (ClassNotFoundException cnfe) {
+ System.out.println("Classname " + args[0] + " not found. Please make sure you use the wholly qualified package name.");
+ System.exit(1);
+ }
+ }
+ Method main = null;
+ try {
+ main = runTMP.getMethod("main", args.getClass());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ if (main == null || !Modifier.isPublic(main.getModifiers()) || !Modifier.isStatic(main.getModifiers())) {
+ System.out.println(args[0] + " must implement a public static void main(String args[]) method");
+ System.exit(1);
+ }
+ final Object thisIsJustOneArgument = argsToPass;
+ final Method finalMain = main;
+ r = new Runnable() {
+ public void run() {
+ try {
+ finalMain.invoke(null, thisIsJustOneArgument);
++ } catch (InvocationTargetException e) {
++ if (e.getCause() != null) {
++ die(e.getCause());
++ } else {
++ // Should never happen, but check anyway.
++ die(e);
++ }
+ } catch (Exception e) {
- System.err.println("Thread \"" + Thread.currentThread().getName() + "\" died " + e);
- e.printStackTrace(System.err);
- System.exit(1);
++ die(e);
+ }
+ }
+ };
+
+ Thread t = new Thread(r, args[0]);
+ t.setContextClassLoader(cl);
+ t.start();
+ } catch (Throwable t) {
+ System.err.println("Uncaught exception: " + t);
+ t.printStackTrace(System.err);
+ System.exit(1);
+ }
+ }
-
++
++ /**
++ * 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");
+ }
+}
[09/10] git commit: Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
Posted by md...@apache.org.
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/master
Commit: 1d396489d380bc533396a28ae1901e50cbb0f07b
Parents: 0e746a2 6258018
Author: Mike Drob <md...@cloudera.com>
Authored: Tue Feb 25 14:47:52 2014 -0500
Committer: Mike Drob <md...@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);
}
}
[05/10] git commit: Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT
Posted by md...@apache.org.
Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT
Conflicts:
src/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/62580184
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/62580184
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/62580184
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 625801848cbb93ac0240eecf09ce62f225ee0960
Parents: 7e106a2 1543d65
Author: Mike Drob <md...@cloudera.com>
Authored: Tue Feb 25 14:38:25 2014 -0500
Committer: Mike Drob <md...@cloudera.com>
Committed: Tue Feb 25 14:38:25 2014 -0500
----------------------------------------------------------------------
.../java/org/apache/accumulo/start/Main.java | 30 ++++++++++++++++----
1 file changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/62580184/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --cc start/src/main/java/org/apache/accumulo/start/Main.java
index cbc90c6,0000000..29c47a7
mode 100644,000000..100644
--- a/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/start/src/main/java/org/apache/accumulo/start/Main.java
@@@ -1,125 -1,0 +1,143 @@@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.start;
+
++import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
-
++
+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();
+ System.exit(1);
+ }
+ final String argsToPass[] = new String[args.length - 1];
+ System.arraycopy(args, 1, argsToPass, 0, args.length - 1);
+
+ Thread.currentThread().setContextClassLoader(AccumuloClassLoader.getClassLoader());
+
+ Class<?> vfsClassLoader = AccumuloClassLoader.getClassLoader().loadClass("org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader");
+
+ ClassLoader cl = (ClassLoader) vfsClassLoader.getMethod("getClassLoader", new Class[] {}).invoke(null, new Object[] {});
+
+ Class<?> runTMP = null;
+
+ Thread.currentThread().setContextClassLoader(cl);
+
+ if (args[0].equals("master")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.master.Master");
+ } else if (args[0].equals("tserver")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.tabletserver.TabletServer");
+ } else if (args[0].equals("shell")) {
+ runTMP = cl.loadClass("org.apache.accumulo.core.util.shell.Shell");
+ } else if (args[0].equals("init")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.Initialize");
+ } else if (args[0].equals("admin")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.Admin");
+ } else if (args[0].equals("gc")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.gc.SimpleGarbageCollector");
+ } else if (args[0].equals("monitor")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.monitor.Monitor");
+ } else if (args[0].equals("tracer")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.trace.TraceServer");
+ } else if (args[0].equals("proxy")) {
+ runTMP = cl.loadClass("org.apache.accumulo.proxy.Proxy");
+ } else if (args[0].equals("classpath")) {
+ vfsClassLoader.getMethod("printClassPath", new Class[] {}).invoke(vfsClassLoader, new Object[] {});
+ return;
+ } else if (args[0].equals("version")) {
+ runTMP = cl.loadClass("org.apache.accumulo.core.Constants");
+ System.out.println(runTMP.getField("VERSION").get(null));
+ return;
+ } else if (args[0].equals("rfile-info")) {
+ runTMP = cl.loadClass("org.apache.accumulo.core.file.rfile.PrintInfo");
+ } else if (args[0].equals("login-info")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.LoginProperties");
+ } else if (args[0].equals("zookeeper")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.ZooKeeperMain");
+ } else if (args[0].equals("info")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.Info");
+ } else {
+ try {
+ runTMP = cl.loadClass(args[0]);
+ } catch (ClassNotFoundException cnfe) {
+ System.out.println("Classname " + args[0] + " not found. Please make sure you use the wholly qualified package name.");
+ System.exit(1);
+ }
+ }
+ Method main = null;
+ try {
+ main = runTMP.getMethod("main", args.getClass());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ if (main == null || !Modifier.isPublic(main.getModifiers()) || !Modifier.isStatic(main.getModifiers())) {
+ System.out.println(args[0] + " must implement a public static void main(String args[]) method");
+ System.exit(1);
+ }
+ final Object thisIsJustOneArgument = argsToPass;
+ final Method finalMain = main;
+ r = new Runnable() {
+ public void run() {
+ try {
+ finalMain.invoke(null, thisIsJustOneArgument);
++ } catch (InvocationTargetException e) {
++ if (e.getCause() != null) {
++ die(e.getCause());
++ } else {
++ // Should never happen, but check anyway.
++ die(e);
++ }
+ } catch (Exception e) {
- System.err.println("Thread \"" + Thread.currentThread().getName() + "\" died " + e);
- e.printStackTrace(System.err);
- System.exit(1);
++ die(e);
+ }
+ }
+ };
+
+ Thread t = new Thread(r, args[0]);
+ t.setContextClassLoader(cl);
+ t.start();
+ } catch (Throwable t) {
+ System.err.println("Uncaught exception: " + t);
+ t.printStackTrace(System.err);
+ System.exit(1);
+ }
+ }
-
++
++ /**
++ * 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");
+ }
+}
[06/10] git commit: Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT
Posted by md...@apache.org.
Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT
Conflicts:
src/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/62580184
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/62580184
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/62580184
Branch: refs/heads/1.5.1-SNAPSHOT
Commit: 625801848cbb93ac0240eecf09ce62f225ee0960
Parents: 7e106a2 1543d65
Author: Mike Drob <md...@cloudera.com>
Authored: Tue Feb 25 14:38:25 2014 -0500
Committer: Mike Drob <md...@cloudera.com>
Committed: Tue Feb 25 14:38:25 2014 -0500
----------------------------------------------------------------------
.../java/org/apache/accumulo/start/Main.java | 30 ++++++++++++++++----
1 file changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/62580184/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --cc start/src/main/java/org/apache/accumulo/start/Main.java
index cbc90c6,0000000..29c47a7
mode 100644,000000..100644
--- a/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/start/src/main/java/org/apache/accumulo/start/Main.java
@@@ -1,125 -1,0 +1,143 @@@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.start;
+
++import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
-
++
+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();
+ System.exit(1);
+ }
+ final String argsToPass[] = new String[args.length - 1];
+ System.arraycopy(args, 1, argsToPass, 0, args.length - 1);
+
+ Thread.currentThread().setContextClassLoader(AccumuloClassLoader.getClassLoader());
+
+ Class<?> vfsClassLoader = AccumuloClassLoader.getClassLoader().loadClass("org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader");
+
+ ClassLoader cl = (ClassLoader) vfsClassLoader.getMethod("getClassLoader", new Class[] {}).invoke(null, new Object[] {});
+
+ Class<?> runTMP = null;
+
+ Thread.currentThread().setContextClassLoader(cl);
+
+ if (args[0].equals("master")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.master.Master");
+ } else if (args[0].equals("tserver")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.tabletserver.TabletServer");
+ } else if (args[0].equals("shell")) {
+ runTMP = cl.loadClass("org.apache.accumulo.core.util.shell.Shell");
+ } else if (args[0].equals("init")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.Initialize");
+ } else if (args[0].equals("admin")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.Admin");
+ } else if (args[0].equals("gc")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.gc.SimpleGarbageCollector");
+ } else if (args[0].equals("monitor")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.monitor.Monitor");
+ } else if (args[0].equals("tracer")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.trace.TraceServer");
+ } else if (args[0].equals("proxy")) {
+ runTMP = cl.loadClass("org.apache.accumulo.proxy.Proxy");
+ } else if (args[0].equals("classpath")) {
+ vfsClassLoader.getMethod("printClassPath", new Class[] {}).invoke(vfsClassLoader, new Object[] {});
+ return;
+ } else if (args[0].equals("version")) {
+ runTMP = cl.loadClass("org.apache.accumulo.core.Constants");
+ System.out.println(runTMP.getField("VERSION").get(null));
+ return;
+ } else if (args[0].equals("rfile-info")) {
+ runTMP = cl.loadClass("org.apache.accumulo.core.file.rfile.PrintInfo");
+ } else if (args[0].equals("login-info")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.LoginProperties");
+ } else if (args[0].equals("zookeeper")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.ZooKeeperMain");
+ } else if (args[0].equals("info")) {
+ runTMP = cl.loadClass("org.apache.accumulo.server.util.Info");
+ } else {
+ try {
+ runTMP = cl.loadClass(args[0]);
+ } catch (ClassNotFoundException cnfe) {
+ System.out.println("Classname " + args[0] + " not found. Please make sure you use the wholly qualified package name.");
+ System.exit(1);
+ }
+ }
+ Method main = null;
+ try {
+ main = runTMP.getMethod("main", args.getClass());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ if (main == null || !Modifier.isPublic(main.getModifiers()) || !Modifier.isStatic(main.getModifiers())) {
+ System.out.println(args[0] + " must implement a public static void main(String args[]) method");
+ System.exit(1);
+ }
+ final Object thisIsJustOneArgument = argsToPass;
+ final Method finalMain = main;
+ r = new Runnable() {
+ public void run() {
+ try {
+ finalMain.invoke(null, thisIsJustOneArgument);
++ } catch (InvocationTargetException e) {
++ if (e.getCause() != null) {
++ die(e.getCause());
++ } else {
++ // Should never happen, but check anyway.
++ die(e);
++ }
+ } catch (Exception e) {
- System.err.println("Thread \"" + Thread.currentThread().getName() + "\" died " + e);
- e.printStackTrace(System.err);
- System.exit(1);
++ die(e);
+ }
+ }
+ };
+
+ Thread t = new Thread(r, args[0]);
+ t.setContextClassLoader(cl);
+ t.start();
+ } catch (Throwable t) {
+ System.err.println("Uncaught exception: " + t);
+ t.printStackTrace(System.err);
+ System.exit(1);
+ }
+ }
-
++
++ /**
++ * 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");
+ }
+}