Customer has been experiencing java.nio.file.AccessDeniedException in Windows family platforms intermittently. The exception is not thrown by an illegal access to the file, but its lock file. The file permission is correctly set. From their analysis, the exception could be caused by the file deletion mechanism of Windows OS. The basic steps are illustrated below: 1. A Java process submit a request to delete a lock file 2. The control is returned from the method but the actual deletion is delayed by Windows. 3. Before the lock file is actually removed, another Java process tries to create a file of same name which throws an AccessDeniedException. Stack Trace(8u121): java.nio.file.AccessDeniedException: xxx.log.lck at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) at sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider. java:115) at java.nio.channels.FileChannel.open(FileChannel.java:287) at java.nio.channels.FileChannel.open(FileChannel.java:335) at java.util.logging.FileHandler.openFiles(FileHandler.java:459) at java.util.logging.FileHandler.<init>(FileHandler.java:402) Customer's request is how they should work around such a situation. e.g. Should deal with the exception in try-cath block in application code Should deal with the exception in the internal JDK's implementation Others
|