> On Jan 20, 2017, at 12:37 PM, Peter Levart <[email protected]> wrote:
> 
> I guess the JmodTask is creating a temp file because it wants the file to not 
> be observed by other processes while it is being written to, right? At the 
> end when the tempTarget is fully written, it is renamed to its intended name 
> with:
> 
> Files.move(tempTarget, target);
> 
> 
> ...but that operation will not be atomic since you didn't pass ATOMIC_MOVE to 
> the CopyOption... options. Even if you did, the atomic move will succeed only 
> when both tempTarget and target point to the same filesystem. Since you are 
> creating tempTarget in default temporary files location (/tmp on UNIXes) this 
> might not be the case (depending on where the real target is located).
> 
> So why don't you simply append a .tmp suffix to the intended target file name 
> when opening the JmodOutputStream. This would ensure the file location will 
> be on the same filesystem as the final target name as it will be created in 
> the same directory. Module path scanning should skip files with .tmp 
> extension then.

Module path only ignores files starts with “.” or is hidden.   This says making 
 the temp file starting with “.” is a possibility.

$ java -p mods -m hi
Error occurred during initialization of VM
java.lang.module.ResolutionException: Unrecognized module: mods/abc.tmp

Mandy

Reply via email to