rename methods
[teamcity/dotNetPackagesSupport.git] / nuget-agent / src / jetbrains / buildServer / nuget / agent / util / DelegatingBuildProcess.java
index 9e9060eaa910e74b702cc730a6a9014db91db264..26dd24bfe94666f735c424de03829c5f79dbb1f0 100644 (file)
@@ -35,14 +35,6 @@ public class DelegatingBuildProcess extends BuildProcessBase {
     myAction = action;\r
   }\r
 \r
-  @Override\r
-  public final void start() throws RunBuildException {\r
-    super.start();\r
-    if (isInterrupted()) return;\r
-\r
-    myReference.set(myAction.startImpl());\r
-  }\r
-\r
   @Override\r
   protected final void interruptImpl() {\r
     super.interruptImpl();\r
@@ -50,22 +42,20 @@ public class DelegatingBuildProcess extends BuildProcessBase {
     if (process != null) process.interrupt();\r
   }\r
 \r
+  @NotNull\r
   @Override\r
   protected final BuildFinishedStatus waitForImpl() throws RunBuildException {\r
-    BuildProcess process = myReference.get();\r
-    if (isInterrupted()) return BuildFinishedStatus.INTERRUPTED;\r
-\r
     try {\r
-      if (process != null) {\r
-        process.start();\r
-        return process.waitFor();\r
-      }\r
+      BuildProcess process = myAction.startImpl();\r
+      myReference.set(process);\r
+\r
+      if (isInterrupted()) return BuildFinishedStatus.INTERRUPTED;\r
+      process.start();\r
+      return process.waitFor();\r
     } finally {\r
+      myReference.set(null);\r
       myAction.finishedImpl();\r
     }\r
-\r
-    if (isInterrupted()) return BuildFinishedStatus.INTERRUPTED;\r
-    return BuildFinishedStatus.FINISHED_SUCCESS;\r
   }\r
 \r
   public static interface Action {\r