Reputation: 1133
I have a multi-threaded java application and the logging code uses File.length in 1 thread but just for logging.
I want to be able to delete from the other threads regardless of this logging.
Can the java.io.File.length() call lock the file and prevent the java.io.File.delete() call from working?
I'm using Windows Sun/Oracle JRE (1.6.0_30 at the moment)
Upvotes: 1
Views: 673
Reputation: 81674
This would be a property of the file system, not the JVM, so it's not possible to answer this with a simple "yes" or "no". The known issue of delete()
not working while a file is open for reading or writing is a Windows-specific problem that doesn't occur on UNIX-like systems.
But in your specific case, it won't be a problem on Windows, Linux, or Mac OS X, and perhaps that answer is good enough!
Upvotes: 1