Package org.eclipse.tycho.core.locking
Class FileLockerImpl
- java.lang.Object
-
- org.eclipse.tycho.core.locking.FileLockerImpl
-
- All Implemented Interfaces:
FileLocker
public class FileLockerImpl extends java.lang.Object implements FileLocker
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringLOCKFILE_SUFFIXprivate org.eclipse.osgi.service.datalocation.LocationlockFileLocation(package private) java.io.FilelockMarkerFile
-
Constructor Summary
Constructors Constructor Description FileLockerImpl(java.io.File file, org.eclipse.osgi.service.datalocation.Location anyLocation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisLocked()Whether the file associated with this locker object is currently locked (by this process or any other process).voidlock()Equivalent to {FileLocker.lock(long)with a timeout argument of 10000 milliseconds.voidlock(long timeout)Attempt to lock the file associated with this locker object.voidrelease()Release the lock if acquired.
-
-
-
Field Detail
-
LOCKFILE_SUFFIX
private static final java.lang.String LOCKFILE_SUFFIX
- See Also:
- Constant Field Values
-
lockFileLocation
private final org.eclipse.osgi.service.datalocation.Location lockFileLocation
-
lockMarkerFile
final java.io.File lockMarkerFile
-
-
Method Detail
-
lock
public void lock()
Description copied from interface:FileLockerEquivalent to {FileLocker.lock(long)with a timeout argument of 10000 milliseconds.- Specified by:
lockin interfaceFileLocker
-
lock
public void lock(long timeout)
Description copied from interface:FileLockerAttempt to lock the file associated with this locker object. Note that technically, not the file itself is locked, but an empty marker file next to it.- Specified by:
lockin interfaceFileLocker- Parameters:
timeout- timeout in milliseconds
-
release
public void release()
Description copied from interface:FileLockerRelease the lock if acquired. Also removes the lock marker file.- Specified by:
releasein interfaceFileLocker
-
isLocked
public boolean isLocked()
Description copied from interface:FileLockerWhether the file associated with this locker object is currently locked (by this process or any other process).- Specified by:
isLockedin interfaceFileLocker
-
-