Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2011
    Posts
    23
    Rep Power
    0

    Lightbulb Java File lock mechanism

    Hello,

    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.

  2. #2
    killutch is offline Member
    Join Date
    Sep 2012
    Posts
    70
    Rep Power
    0

    Default Re: Java File lock mechanism

    not sure might want to poke around int he api and just read stuff maybe you will stumble on the solution.

Similar Threads

  1. Java 1.0 event handling mechanism....
    By Cosmos in forum Advanced Java
    Replies: 2
    Last Post: 10-23-2011, 09:58 PM
  2. Record Lock in Java
    By sfaisalawan in forum JDBC
    Replies: 1
    Last Post: 05-08-2011, 09:10 AM
  3. Ldap bind mechanism in java
    By ppo in forum Advanced Java
    Replies: 5
    Last Post: 06-10-2010, 04:25 AM
  4. Logger and file lock
    By segolas in forum Advanced Java
    Replies: 3
    Last Post: 01-14-2010, 05:02 PM
  5. lock a file
    By flaca in forum New To Java
    Replies: 3
    Last Post: 08-19-2008, 04:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •