public class ReentrantFileLock extends ReentrantLock
ReentrantLock with FileLock
private static final ReentrantFileLockFactory fileLockFactory = newReentrantFileLockFactory("target/droolsassert/lock");
private static final ReentrantFileLock consolidatedReportLock = fileLockFactory.newLock(ActivationReportBuilder.class.getName());
consolidatedReportLock.lock();
try {
...
} finally {
consolidatedReportLock.unlock();
}
FileLock,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
ReentrantFileLock.ReentrantFileLockFactory |
| Constructor and Description |
|---|
ReentrantFileLock(int id,
FileChannel lockFileChannel) |
| Modifier and Type | Method and Description |
|---|---|
void |
lock() |
void |
lockInterruptibly() |
static ReentrantFileLock.ReentrantFileLockFactory |
newReentrantFileLockFactory(File file) |
static ReentrantFileLock.ReentrantFileLockFactory |
newReentrantFileLockFactory(String filePath) |
boolean |
tryLock() |
boolean |
tryLock(long timeout,
TimeUnit unit) |
void |
unlock() |
getHoldCount, getOwner, getQueuedThreads, getQueueLength, getWaitingThreads, getWaitQueueLength, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isHeldByCurrentThread, isLocked, newCondition, toStringpublic ReentrantFileLock(int id,
FileChannel lockFileChannel)
public static final ReentrantFileLock.ReentrantFileLockFactory newReentrantFileLockFactory(String filePath)
public static final ReentrantFileLock.ReentrantFileLockFactory newReentrantFileLockFactory(File file)
public void lock()
lock in interface Locklock in class ReentrantLockpublic void lockInterruptibly()
throws InterruptedException
lockInterruptibly in interface LocklockInterruptibly in class ReentrantLockInterruptedExceptionpublic boolean tryLock()
tryLock in interface LocktryLock in class ReentrantLockpublic boolean tryLock(long timeout,
TimeUnit unit)
throws InterruptedException
tryLock in interface LocktryLock in class ReentrantLockInterruptedExceptionpublic void unlock()
unlock in interface Lockunlock in class ReentrantLockCopyright © 2021. All rights reserved.