public class TSQueueLock extends AbstractTSQueueLock implements QueueLock
dontRecoverLockTimeout, 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 |
quietUnlock()
wont report if it was unable to unlock, useful when closing, and you are not sure if you hold the lock in the first place.
|
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.
|
forceUnlock, forceUnlockIfProcessIsDead, performClose, threadSafetyCheck
assertCloseablesClosed, clearUsedByThread, close, createdHere, disableCloseableTracing, enableCloseableTracing, isClosed, isClosing, isInUserThread, performCloseInBackground, referenceId, resetUsedByThread, shouldPerformCloseInBackground, shouldWaitForClosed, throwExceptionIfClosed, throwExceptionIfClosedInSetter, toString, unmonitor, waitForClosed, warnAndCloseIfNotClosed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close, closeQuietly, closeQuietly, notifyClosing
public 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 QueueLock
public 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 QueueLock
public void unlock()
ChronicleQueue.acquireAppender()
.public void quietUnlock()
QueueLock
quietUnlock
in interface QueueLock
Copyright © 2020. All rights reserved.