Repository: incubator-slider
Updated Branches:
  refs/heads/develop 548e8505b -> 634c125b0


SLIDER-201 closing process input stream on fork


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/634c125b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/634c125b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/634c125b

Branch: refs/heads/develop
Commit: 634c125b0dae9a70575469e1a0f8707af09ab223
Parents: 548e850
Author: Steve Loughran <[email protected]>
Authored: Fri Nov 7 17:24:02 2014 +0000
Committer: Steve Loughran <[email protected]>
Committed: Fri Nov 7 17:24:02 2014 +0000

----------------------------------------------------------------------
 .../apache/slider/server/services/workflow/LongLivedProcess.java | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/634c125b/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcess.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcess.java
 
b/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcess.java
index 57b989c..cebb035 100644
--- 
a/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcess.java
+++ 
b/slider-core/src/main/java/org/apache/slider/server/services/workflow/LongLivedProcess.java
@@ -51,6 +51,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
  * Key Features:
  * <ol>
  *   <li>Output is streamed to the output logger provided</li>.
+ *   <li>the input stream is closed as soon as the process starts.</li>
  *   <li>The most recent lines of output are saved to a linked list</li>.
  *   <li>A synchronous callback, {@link LongLivedProcessLifecycleEvent}, is 
raised on the start
  *   and finish of a process.</li>
@@ -323,6 +324,8 @@ public class LongLivedProcess implements Runnable {
       lifecycleCallback.onProcessStarted(this);
     }
     try {
+      //close stdin for the process
+      IOUtils.closeStream(process.getOutputStream());
       exitCode = process.waitFor();
     } catch (InterruptedException e) {
       LOG.debug("Process wait interrupted -exiting thread", e);
@@ -416,6 +419,7 @@ public class LongLivedProcess implements Runnable {
     }
     return getRecentOutput();
   }
+
   /**
    * add the recent line to the list of recent lines; deleting
    * an earlier on if the limit is reached.

Reply via email to