public class TSQueueLock extends AbstractTSQueueLock implements QueueLock
lock, path, pauser, tableStore, UNLOCKED| Constructor and Description |
|---|
TSQueueLock(TableStore<?> tableStore,
Supplier<net.openhft.chronicle.threads.TimingPauser> pauser,
Long timeoutMs) |
| Modifier and Type | Method and Description |
|---|---|
void |
acquireLock()
Stores current PID to table store, and any other process trying to acquire lock will wait for
chronicle.queue.lock.timeoutMS millis (default is 30000) for the lock to be released, and if it is not
after timeout, throws IllegalStateException. |
void |
unlock()
Checks if the lock is held by current thread and if so, releases it, removing entry from TableStore and clearing
ThreadLocal state, allowing anyone to proceed with
ChronicleQueue.acquireAppender(). |
void |
waitForLock()
checks if current thread holds lock.
|
close, closeCheck, forceUnlockpublic TSQueueLock(TableStore<?> tableStore, Supplier<net.openhft.chronicle.threads.TimingPauser> pauser, Long timeoutMs)
public void acquireLock()
chronicle.queue.lock.timeoutMS millis (default is 30000) for the lock to be released, and if it is not
after timeout, throws IllegalStateException. Also the locking thread ID is stored in threadLocal field, so
that only locking thread is allowed to ChronicleQueue.acquireAppender() while the queue is locked.acquireLock in interface QueueLockpublic void waitForLock()
chronicle.queue.lock.timeoutMS millis
for the lock to be released, and if it is not after timeout, throws IllegalStateException.waitForLock in interface QueueLockpublic void unlock()
ChronicleQueue.acquireAppender().Copyright © 2020. All rights reserved.