org.eclipse.tesla.aether.concurrency
Interface FileLockManager.Lock

Enclosing interface:
FileLockManager

public static interface FileLockManager.Lock

This lock object adds the ability to directly access the contents of the locked file.

Author:
Benjamin Hanzelmann

Method Summary
 File getFile()
          Get the file this Lock was obtained for.
 RandomAccessFile getRandomAccessFile()
          Gets the random access file used to read/write the contents of the locked file.
 boolean isShared()
          Tells whether the lock is shared or exclusive.
 void lock()
          Lock the file this Lock was obtained for.
 void unlock()
          Unlock the file this Lock was obtained for.
 

Method Detail

getRandomAccessFile

RandomAccessFile getRandomAccessFile()
                                     throws IOException
Gets the random access file used to read/write the contents of the locked file.

Returns:
The random access file used to read/write or null if the lock isn't acquired.
Throws:
IOException

isShared

boolean isShared()
Tells whether the lock is shared or exclusive.

Returns:
true if the lock is shared, false if the lock is exclusive.

lock

void lock()
          throws IOException
Lock the file this Lock was obtained for.

Multiple lock() invocations on the same or other lock objects using the same (canonical) file as target are possible and non-blocking from the same caller thread.

Throws:
IOException - if an error occurs while locking the file.

unlock

void unlock()
            throws IOException
Unlock the file this Lock was obtained for.

Throws:
IOException - if an error occurs while locking the file.

getFile

File getFile()
Get the file this Lock was obtained for.

Returns:
The file this lock was obtained for, never null.


Copyright © 2010-2012. All Rights Reserved.