org.apache.ignite.internal.util

## Class GridStripedReadWriteLock

- java.lang.Object
- - org.apache.ignite.internal.util.GridStripedReadWriteLock

    public class GridStripedReadWriteLock
    extends Object

This is an utility class for 'splitting' locking of some `int`- or `long`-keyed resources. Map `int` and `long` values to some number of locks, and supply convenience methods to obtain and release these locks using key values.

### Constructor Summary

Constructors
Constructor and Description
`GridStripedReadWriteLock(int concurrencyLevel)` Creates new instance with the given concurrency level (number of locks).

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `concurrencyLevel()` Gets concurrency level.
`ReadWriteLock[]` `getAllLocks()` Gets all locks.
`ReadWriteLock` `getLock(int key)` Returns `Lock` object for the given key.
`ReadWriteLock` `getLock(long key)` Returns `Lock` object for the given key.
`ReadWriteLock` `getLock(@Nullable Object o)` Returns lock for object.
`String` `toString()`

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

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

### Constructor Detail

#### GridStripedReadWriteLock

    public GridStripedReadWriteLock(int concurrencyLevel)

Creates new instance with the given concurrency level (number of locks).

Parameters:
  `concurrencyLevel` - Concurrency level.

### Method Detail

#### concurrencyLevel

    public int concurrencyLevel()

Gets concurrency level.

Returns:
  Concurrency level.

#### getAllLocks

    public ReadWriteLock[] getAllLocks()

Gets all locks.

Returns:
  All locks.

#### getLock

    public ReadWriteLock getLock(int key)

Returns `Lock` object for the given key.

Parameters:
  `key` - Key.
Returns:
  Lock.

#### getLock

    public ReadWriteLock getLock(long key)

Returns `Lock` object for the given key.

Parameters:
  `key` - Key.
Returns:
  Lock.

#### getLock

    public ReadWriteLock getLock(@Nullable
                                 @Nullable Object o)

Returns lock for object.

Parameters:
  `o` - Object.
Returns:
  Lock.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

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