You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@twill.apache.org by ch...@apache.org on 2017/02/28 19:45:17 UTC

[3/9] twill git commit: Remove unnecessary intermediate method

Remove unnecessary intermediate method

Project: http://git-wip-us.apache.org/repos/asf/twill/repo
Commit: http://git-wip-us.apache.org/repos/asf/twill/commit/209f3ce2
Tree: http://git-wip-us.apache.org/repos/asf/twill/tree/209f3ce2
Diff: http://git-wip-us.apache.org/repos/asf/twill/diff/209f3ce2

Branch: refs/heads/feature/twill-186
Commit: 209f3ce2eb4596bdd0f675b23a78f189e8e067a2
Parents: cc50d47
Author: Terence Yim <ch...@apache.org>
Authored: Mon Feb 27 21:29:32 2017 -0800
Committer: Terence Yim <ch...@apache.org>
Committed: Mon Feb 27 21:29:32 2017 -0800

----------------------------------------------------------------------
 .../internal/appmaster/ApplicationMasterService.java | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/twill/blob/209f3ce2/twill-yarn/src/main/java/org/apache/twill/internal/appmaster/ApplicationMasterService.java
----------------------------------------------------------------------
diff --git a/twill-yarn/src/main/java/org/apache/twill/internal/appmaster/ApplicationMasterService.java b/twill-yarn/src/main/java/org/apache/twill/internal/appmaster/ApplicationMasterService.java
index dd08cdc..3044098 100644
--- a/twill-yarn/src/main/java/org/apache/twill/internal/appmaster/ApplicationMasterService.java
+++ b/twill-yarn/src/main/java/org/apache/twill/internal/appmaster/ApplicationMasterService.java
@@ -921,18 +921,9 @@ public final class ApplicationMasterService extends AbstractYarnTwillService imp
   /**
    * Helper method to restart instances of runnables.
    */
-  private void restartRunnableInstances(String runnableName, @Nullable Set<Integer> instanceIds,
+  private void restartRunnableInstances(final String runnableName, @Nullable final Set<Integer> instanceIds,
                                         final Runnable completion) {
-    Runnable restartInstancesRunnable = createRestartInstancesRunnable(runnableName, instanceIds, completion);
-    instanceChangeExecutor.execute(restartInstancesRunnable);
-  }
-
-  /**
-   * Creates a Runnable for execution of restart instances request.
-   */
-  private Runnable createRestartInstancesRunnable(final String runnableName, @Nullable final Set<Integer> instanceIds,
-                                                  final Runnable completion) {
-    return new Runnable() {
+    instanceChangeExecutor.execute(new Runnable() {
       @Override
       public void run() {
         LOG.debug("Begin restart runnable {} instances.", runnableName);
@@ -966,7 +957,7 @@ public final class ApplicationMasterService extends AbstractYarnTwillService imp
 
         completion.run();
       }
-    };
+    });
   }
 
   /**