Changes between Version 1 and Version 2 of Ticket #16296, comment 7


Ignore:
Timestamp:
Jul 3, 2015, 5:43:21 PM (4 years ago)
Author:
leeroy
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16296, comment 7

    v1 v2  
    22
    33Yes, FileLock works if the locking mechanism is rewritten to use !FileChannel.open. I can't remember what I did before, closer to original code I think, but the tryLock method didn't work that way. It now works so I'll replace that last patch. You should find this is closer to how tor handles file locking.
     4
     5In case you're worried about the absence of a FileChannel.close(), try adding DELETE_ON_CLOSE to FileChannel.open(). Which shows that java doesn't even create the file. There is no leak because even in the current implementation the updater creates a new LockFile each time so the file descriptor gets GC'd at this point. Similarly, for the permission checking code, the methods are static, and so are GC'd on an early return from checking directory contents.