开发者

Can a batch file execution step through sequence without completing a java process?

开发者 https://www.devze.com 2023-01-06 07:05 出处:网络
Does a 开发者_开发问答batch file execute processes in sequence only if the previous step has completed and released all file/process locks?

Does a 开发者_开发问答batch file execute processes in sequence only if the previous step has completed and released all file/process locks?

Suppose I have the following cmd file (mybatchfile.cmd)

echo. |TIME
java myjar.jar
echo. |TIME

and I pipe the results to a log file.

Can I be 100% confident (on windows) that my java process has completed and released all file/process locks when the second echo timestamp has occurred?


If your Java program launches another process then no, you have no control. For the most part it is a reasonable assumption, not 100%

EDIT: Another item that might take a while are server sockets. The sockets might be in a WAIT state for a while before being released by the OS.


Yes, provided java wasn't killed, you can be confident it has completed normally. Regardless, the locks will be released.

0

精彩评论

暂无评论...
验证码 换一张
取 消