How does FileLock work?

前端 未结 5 2044
-上瘾入骨i
-上瘾入骨i 2020-11-30 11:14

I\'ve been trying to use FileLock to get exclusive access to a file in order to:

  • delete it
  • rename it
  • write to it

5条回答
  •  甜味超标
    2020-11-30 11:58

    The lock you've for is locking a region inside a file, but not the file itself, so while region is locked you can't delete or rename the file.

    You may want to look at the Commons Transaction project.

提交回复
热议问题