I have used RandomAccessFile J2SE 6 class to implement lock mechanism on .xml file.
I want a mechanism that .xml file should be locked for "rw" [read write] but it should be opened to "r" [read] mode.
objFileChannel.tryLock(0L, Long.MAX_VALUE, true); This function locks the .xml file with sharing allowed. But it opens the .xml in all the cases even if i want to open .xml in read write mode or it's only read mode.
What should i use for sharing the lock mechanism for that file?
Thanks in advance.