This content has been marked as final. Show 5 replies
Is it like windows has implemented locking and Apple has not implemented ?
Actually I tried using 2 threads.
Thread 1 opens the file, writes in the file, continously flushes into the file and second thread tries to delete the file.
In this scenario also I am expecting an exception but I am not getting in Apple but works fine in Windows.
What might be the issue?
Edited by: 851636 on Apr 12, 2011 3:16 AM
The platforms have different behaviours, due to some stupid decisions made in Unix ('advisory file locking') in about 1983 by people who I am sorry to say didn't know what they were talking about. I told them at the time ;-(
In the upshot, Java has no choice but to implement the lowest common denominator behaviour, ie lock does not lock against delete or even read :-(((((((
All you can do about it is not rely on any behaviour that isn't specified.