org.apache.ignite.internal.processors.cache.persistence.checkpoint

## 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
`static ThreadLocal<Integer>` `CHECKPOINT_LOCK_HOLD_COUNT` Checkpoint lock hold count.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `checkpointLockIsHeldByThread()` This method works only if the assertion is enabled or it always returns true otherwise.
`int` `getReadHoldCount()`
`boolean` `isWriteLockHeldByCurrentThread()`
`void` `readLock()` Gets the checkpoint read lock.
`void` `readUnlock()` Releases the checkpoint read lock.
`boolean` `tryReadLock(long timeout, TimeUnit unit)` Gets the checkpoint read lock.
`void` `writeLock()` Take the checkpoint write lock.
`void` `writeUnlock()` Release the checkpoint write lock

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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 InterruptedException

Gets 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:
  `true` if 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:
  `true` if current thread hold the write lock.

#### writeUnlock

    public void writeUnlock()

Release the checkpoint write lock

#### getReadHoldCount

    public int getReadHoldCount()

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023