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.
精彩评论