commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ulrich berl" <ulrich.b...@gmx.net>
Subject [exec] Watchdog not working when starting two processes successively
Date Thu, 10 Sep 2015 07:06:08 GMT
Made the following changes in TutorialTest.java to start a second job:

... 
// use a infinte loop shell script, echoes counter variable every second
final CommandLine commandLine = new CommandLine("c:\\scripts\\echoInfiniteLoop.bat");
...
// asynchronous
final boolean printInBackground = true;
...
// printing takes around 10 seconds           
System.out.println("[main] Preparing print job ...");
printResult = print(pdfFile, printJobTimeout, printInBackground);
//Thread.sleep(100);
print(pdfFile, 1000, printInBackground);
System.out.println("[main] Successfully sent the print job ...");

RESULT
----------------- 
if the Thread.sleep(100) is omitted, then the watchdog for the second job doesnt work properly:
the output of the resultHandler occurs until after the end of the first job.
 
[main] Preparing print job ...
[print] Executing non-blocking print job  ...
[print] Executing non-blocking print job  ...
[main] Successfully sent the print job ...
[main] Test is exiting but waiting for the print job to finish...
1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[resultHandler] The print process timed out
[resultHandler] The print process timed out
[main] The print job has finished ...
 
if the Thread.sleep(100) is used, the watchdog runs properly:
 
[main] Preparing print job ...
[print] Executing non-blocking print job  ...
1
[print] Executing non-blocking print job  ...
[main] Successfully sent the print job ...
[main] Test is exiting but waiting for the print job to finish...
1
2
2
[resultHandler] The print process timed out
3
4
5
6
7
8
9
10
11
12
13
14
15
[resultHandler] The print process timed out
[main] The print job has finished ...

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message