accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmil...@apache.org
Subject accumulo git commit: ACCUMULO-4696 Cleaned up Main
Date Tue, 22 Aug 2017 19:22:16 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master d63181a06 -> 82a156868


ACCUMULO-4696 Cleaned up Main


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

Branch: refs/heads/master
Commit: 82a15686893cc2f1b26777664093fa1ac312248a
Parents: d63181a
Author: Mike Miller <mmiller@apache.org>
Authored: Tue Aug 22 14:50:56 2017 -0400
Committer: Mike Miller <mmiller@apache.org>
Committed: Tue Aug 22 14:50:56 2017 -0400

----------------------------------------------------------------------
 .../java/org/apache/accumulo/start/Main.java    | 43 +++++++++-----------
 1 file changed, 19 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/82a15686/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/Main.java b/start/src/main/java/org/apache/accumulo/start/Main.java
index 5e7858e..e37f1a4 100644
--- a/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/start/src/main/java/org/apache/accumulo/start/Main.java
@@ -21,6 +21,7 @@ import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.Map;
 import java.util.ServiceLoader;
 import java.util.TreeMap;
@@ -116,14 +117,11 @@ public class Main {
   }
 
   private static void execKeyword(final KeywordExecutable keywordExec, final String[] args)
{
-    Runnable r = new Runnable() {
-      @Override
-      public void run() {
-        try {
-          keywordExec.execute(args);
-        } catch (Exception e) {
-          die(e);
-        }
+    Runnable r = () -> {
+      try {
+        keywordExec.execute(args);
+      } catch (Exception e) {
+        die(e);
       }
     };
     startThread(r, keywordExec.keyword());
@@ -153,22 +151,19 @@ public class Main {
       System.exit(1);
     }
     final Method finalMain = main;
-    Runnable r = new Runnable() {
-      @Override
-      public void run() {
-        try {
-          final Object thisIsJustOneArgument = args;
-          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) {
+    Runnable r = () -> {
+      try {
+        final Object thisIsJustOneArgument = args;
+        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) {
+        die(e);
       }
     };
     startThread(r, classWithMain.getName());
@@ -203,10 +198,10 @@ public class Main {
   }
 
   public static void printUsage() {
-    TreeSet<KeywordExecutable> executables = new TreeSet<>((x, y) -> x.keyword().compareTo(y.keyword()));
+    TreeSet<KeywordExecutable> executables = new TreeSet<>(Comparator.comparing(KeywordExecutable::keyword));
     executables.addAll(getExecutables(getClassLoader()).values());
 
-    System.out.println("\nUsage: accumulo <command> [-h] (<argument> ...)\n\n
 -h   Prints usage for specified command");
+    System.out.println("\nUsage: accumulo <command> [--help] (<argument> ...)\n\n
 --help   Prints usage for specified command");
     System.out.println("\nCore Commands:");
     printCommands(executables, UsageGroup.CORE);
 


Mime
View raw message