org.apache.ignite.internal.client.util

## Class GridClientStripedLock

- java.lang.Object
- - org.apache.ignite.internal.client.util.GridClientStripedLock

    public class GridClientStripedLock
    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
`GridClientStripedLock(int concurrencyLevel)` Creates new instance with the given concurrency level (number of locks).

### Method Summary

Methods
`int` `concurrencyLevel()` Gets concurrency level.
`Lock` `getLock(int key)` Returns `Lock` object for the given key.
`Lock` `getLock(long key)` Returns `Lock` object for the given key.
`Lock` `getLock(Object o)` Returns lock for object.
`void` `lock(int key)` Locks given key.
`void` `lock(long key)` Locks given key.
`void` `lock(Object o)` Locks an object.
`void` `unlock(int key)` Unlocks given key.
`void` `unlock(long key)` Unlocks given key.
`void` `unlock(Object o)` Unlocks an object.

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

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

### Constructor Detail

#### GridClientStripedLock

    public GridClientStripedLock(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.

#### getLock

    public Lock getLock(int key)

Returns `Lock` object for the given key.

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

#### getLock

    public Lock getLock(long key)

Returns `Lock` object for the given key.

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

#### getLock

    public Lock getLock(Object o)

Returns lock for object.

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

#### lock

    public void lock(int key)

Locks given key.

Parameters:
  `key` - Key.

#### unlock

    public void unlock(int key)

Unlocks given key.

Parameters:
  `key` - Key.

#### lock

    public void lock(long key)

Locks given key.

Parameters:
  `key` - Key.

#### unlock

    public void unlock(long key)

Unlocks given key.

Parameters:
  `key` - Key.

#### lock

    public void lock(Object o)

Locks an object.

Parameters:
  `o` - Object.

#### unlock

    public void unlock(Object o)

Unlocks an object.

Parameters:
  `o` - Object.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.6.0
Release Date | : May 18 2016