org.eclipse.tesla.aether.concurrency
Class DefaultFileLockManager
java.lang.Object
org.eclipse.tesla.aether.concurrency.DefaultFileLockManager
- All Implemented Interfaces:
- FileLockManager, org.sonatype.aether.spi.locator.Service
@Component(role=FileLockManager.class)
public class DefaultFileLockManager
- extends Object
- implements FileLockManager, org.sonatype.aether.spi.locator.Service
Offers advisory file locking independently of the platform. With regard to concurrent readers that don't use any file
locking (i.e. 3rd party code accessing files), mandatory locking (as seen on Windows) must be avoided as this would
immediately kill the unaware readers. To emulate advisory locking, this implementation uses a dedicated lock file
(*.aetherlock) next to the actual file. The inter-process file locking is performed on this lock file, thereby
keeping the data file free from locking.
- Author:
- Benjamin Bentmann
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultFileLockManager
public DefaultFileLockManager()
DefaultFileLockManager
public DefaultFileLockManager(org.sonatype.aether.spi.log.Logger logger)
setLogger
public void setLogger(org.sonatype.aether.spi.log.Logger logger)
- Set the logger to use.
- Parameters:
logger - The logger to use. If null, disable logging.
initService
public void initService(org.sonatype.aether.spi.locator.ServiceLocator locator)
- Specified by:
initService in interface org.sonatype.aether.spi.locator.Service
readLock
public FileLockManager.Lock readLock(File target)
- Description copied from interface:
FileLockManager
- Obtain a lock object that may be used to lock the target file for reading. This method must not lock that file
right immediately (see
FileLockManager.Lock.lock()).
- Specified by:
readLock in interface FileLockManager
- Parameters:
target - the file to lock, never null.
- Returns:
- a lock object, never
null.
writeLock
public FileLockManager.Lock writeLock(File target)
- Description copied from interface:
FileLockManager
- Obtain a lock object that may be used to lock the target file for writing. This method must not lock that file
right immediately (see
FileLockManager.Lock.lock()).
- Specified by:
writeLock in interface FileLockManager
- Parameters:
target - the file to lock, never null.
- Returns:
- a lock object, never
null.
Copyright © 2010-2012. All Rights Reserved.