Class CheckpointReadWriteLock
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointReadWriteLock
-
public class CheckpointReadWriteLock extends Object
Wrapper of the classic read write lock with checkpoint features.
-
-
Field Summary
Fields Modifier and Type Field Description static ThreadLocal<Integer>CHECKPOINT_LOCK_HOLD_COUNTCheckpoint lock hold count.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckpointLockIsHeldByThread()This method works only if the assertion is enabled or it always returns true otherwise.intgetReadHoldCount()booleanisWriteLockHeldByCurrentThread()voidreadLock()Gets the checkpoint read lock.voidreadUnlock()Releases the checkpoint read lock.booleantryReadLock(long timeout, TimeUnit unit)Gets the checkpoint read lock.voidwriteLock()Take the checkpoint write lock.voidwriteUnlock()Release the checkpoint write lock
-
-
-
Field Detail
-
CHECKPOINT_LOCK_HOLD_COUNT
public static final ThreadLocal<Integer> CHECKPOINT_LOCK_HOLD_COUNT
Checkpoint lock hold count.
-
-
Method Detail
-
readLock
public void readLock()
Gets the checkpoint read lock. While this lock is held, checkpoint thread will not acquireSnapshotWorker memory state.- Throws:
IgniteException- If failed.
-
tryReadLock
public boolean tryReadLock(long timeout, TimeUnit unit) throws InterruptedExceptionGets the checkpoint read lock. While this lock is held, checkpoint thread will not acquireSnapshotWorker memory state.- Throws:
IgniteException- If failed.InterruptedException
-
checkpointLockIsHeldByThread
public boolean checkpointLockIsHeldByThread()
This method works only if the assertion is enabled or it always returns true otherwise.- Returns:
trueif checkpoint lock is held by current thread.
-
readUnlock
public void readUnlock()
Releases the checkpoint read lock.
-
writeLock
public void writeLock()
Take the checkpoint write lock.
-
isWriteLockHeldByCurrentThread
public boolean isWriteLockHeldByCurrentThread()
- Returns:
trueif current thread hold the write lock.
-
writeUnlock
public void writeUnlock()
Release the checkpoint write lock
-
getReadHoldCount
public int getReadHoldCount()
-
-