1 4 package com.tc.process; 5 6 import java.io.File ; 7 import java.io.FileOutputStream ; 8 9 13 public class LinkedJavaProcessTestMain5 { 14 15 public static void main(String [] args) throws Exception { 16 File destFile = new File (args[0]); 17 boolean spawnChildren = new Boolean (args[1]).booleanValue(); 18 19 if (spawnChildren) { 20 LinkedJavaProcess child1 = new LinkedJavaProcess(LinkedJavaProcessTestMain5.class.getName(), 21 new String [] { args[0] + "-child-1", "false" }); 22 LinkedJavaProcess child2 = new LinkedJavaProcess(LinkedJavaProcessTestMain5.class.getName(), 23 new String [] { args[0] + "-child-2", "false" }); 24 25 child1.start(); 26 child2.start(); 27 } 28 29 while (true) { 30 FileOutputStream out = new FileOutputStream (destFile, true); 31 out.write("DATA: Just a line of text.\n".getBytes()); 32 out.flush(); 33 out.close(); 34 35 Thread.sleep(100); 36 } 37 } 38 39 } 40 | Popular Tags |