Originally posted by Tejas Chachcha:
Is there any solution to this scenario? If we want to make access from different jvms synchronized? Does it mean that synchronization/threading can make java somewhat plateform independent?
There's a few ways. One way is to have a process "own" that resource. Another is to make use of the file system's atomicity and java.io.File's createNewFile() method to create files on a file system that represent resources you want to lock. This second method is usally used despite the fact you have to watch out for a bunch of things like the app dying without releasing the lock... (This is usually fixed by some sort of keep-alive time stamp thing).
See ->
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4676183 .. why making use of deletion on exit doesn't always work
I've used both app based system wide locks and file based system wide locks in past projects with great success...