org.apache.ignite.internal.processors.datastructures

## Class DataStructuresProcessor

- java.lang.Object
- - org.apache.ignite.internal.processors.GridProcessorAdapter
  - - org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor

All Implemented Interfaces:
  GridComponent, IgniteChangeGlobalStateSupport, GridProcessor

    public final class DataStructuresProcessor
    extends GridProcessorAdapter
    implements IgniteChangeGlobalStateSupport

Manager of data structures.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent

`GridComponent.DiscoveryDataExchangeType`

### Field Summary

Fields
`static CacheDataStructuresConfigurationKey` `DATA_STRUCTURES_KEY`

### Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter

`ctx, log`

### Constructor Summary

Constructors
Constructor and Description
`DataStructuresProcessor(GridKernalContext ctx)`

### Method Summary

Methods
`IgniteAtomicLong` `atomicLong(String name, long initVal, boolean create)` Gets an atomic long from cache or creates one if it's not cached.
`<T> IgniteAtomicReference<T>` `atomicReference(String name, T initVal, boolean create)` Gets an atomic reference from cache or creates one if it's not cached.
`<T,S> IgniteAtomicStamped<T,S>` `atomicStamped(String name, T initVal, S initStamp, boolean create)` Gets an atomic stamped from cache or creates one if it's not cached.
`IgniteCountDownLatch` `countDownLatch(String name, int cnt, boolean autoDel, boolean create)` Gets or creates count down latch.
`void` `onActivate(GridKernalContext ctx)` Called when cluster performing activation.
`void` `onDeActivate(GridKernalContext ctx)` Called when cluster performing deactivation.
`void` `onKernalStart(boolean activeOnStart)` Callback that notifies that kernal has successfully started, including all managers and processors.
`void` `onKernalStop(boolean cancel)` Callback to notify that kernal is about to stop.
`IgniteInternalFuture<?>` `onReconnected(boolean clusterRestarted)` Client reconnected callback.
`void` `printMemoryStats()` Prints memory statistics (sizes of internal structures, etc.).
`<T> IgniteQueue<T>` `queue(String name, int cap, CollectionConfiguration cfg)` Gets a queue from cache or creates one if it's not cached.
`IgniteLock` `reentrantLock(String name, boolean failoverSafe, boolean fair, boolean create)` Gets or creates reentrant lock.
`void` `removeCountDownLatch(String name)` Removes count down latch from cache.
`void` `removeQueue(String name, GridCacheContext cctx)`
`void` `removeReentrantLock(String name, boolean broken)` Removes reentrant lock from cache.
`void` `removeSemaphore(String name)` Removes semaphore from cache.
`void` `removeSet(String name, GridCacheContext cctx)`
`static <R> R` `retry(IgniteLogger log, Callable<R> call)`
`IgniteSemaphore` `semaphore(String name, int cnt, boolean failoverSafe, boolean create)` Gets or creates semaphore.
`IgniteAtomicSequence` `sequence(String name, long initVal, boolean create)` Gets a sequence from cache or creates one if it's not cached.
`<T> IgniteSet<T>` `set(String name, CollectionConfiguration cfg)` Gets a set from cache or creates one if it's not cached.
`void` `start(boolean activeOnStart)` Starts grid component.

### Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter

`assertParameter, collectGridNodeData, collectJoiningNodeData, discoveryDataType, onDisconnected, onGridDataReceived, onJoiningNodeDataReceived, stop, toString, validateNode`

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

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

### Field Detail

#### DATA_STRUCTURES_KEY

    public static final CacheDataStructuresConfigurationKey DATA_STRUCTURES_KEY

### Constructor Detail

#### DataStructuresProcessor

    public DataStructuresProcessor(GridKernalContext ctx)

Parameters:
  `ctx` - Context.

### Method Detail

#### start

    public void start(boolean activeOnStart)
               throws IgniteCheckedException

Starts grid component.

Specified by:
  `start` in interface `GridComponent`
Overrides:
  `start` in class `GridProcessorAdapter`
Throws:
  `IgniteCheckedException` - Throws in case of any errors.

#### onKernalStart

    public void onKernalStart(boolean activeOnStart)
                       throws IgniteCheckedException

Callback that notifies that kernal has successfully started, including all managers and processors.

Specified by:
  `onKernalStart` in interface `GridComponent`
Overrides:
  `onKernalStart` in class `GridProcessorAdapter`
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### onKernalStop

    public void onKernalStop(boolean cancel)

Callback to notify that kernal is about to stop.

Specified by:
  `onKernalStop` in interface `GridComponent`
Overrides:
  `onKernalStop` in class `GridProcessorAdapter`
Parameters:
  `cancel` - Flag indicating whether jobs should be canceled.

#### onActivate

    public void onActivate(GridKernalContext ctx)
                    throws IgniteCheckedException

Called when cluster performing activation.

Specified by:
  `onActivate` in interface `IgniteChangeGlobalStateSupport`
Parameters:
  `ctx` - Kernal context.
Throws:
  `IgniteCheckedException` - If failed.

#### onDeActivate

    public void onDeActivate(GridKernalContext ctx)
                      throws IgniteCheckedException

Called when cluster performing deactivation.

Specified by:
  `onDeActivate` in interface `IgniteChangeGlobalStateSupport`
Parameters:
  `ctx` - Kernal context.
Throws:
  `IgniteCheckedException` - If failed.

#### onReconnected

    public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted)
                                          throws IgniteCheckedException

Client reconnected callback.

Specified by:
  `onReconnected` in interface `GridComponent`
Overrides:
  `onReconnected` in class `GridProcessorAdapter`
Parameters:
  `clusterRestarted` - Cluster restarted flag.
Returns:
  Future to wait before completing reconnect future.
Throws:
  `IgniteCheckedException` - If failed.

#### sequence

    public final IgniteAtomicSequence sequence(String name,
                                long initVal,
                                boolean create)
                                        throws IgniteCheckedException

Gets a sequence from cache or creates one if it's not cached.

Parameters:
  `name` - Sequence name.
  `initVal` - Initial value for sequence. If sequence already cached, `initVal` will be ignored.
  `create` - If `true` sequence will be created in case it is not in cache.
Returns:
  Sequence.
Throws:
  `IgniteCheckedException` - If loading failed.

#### atomicLong

    public final IgniteAtomicLong atomicLong(String name,
                              long initVal,
                              boolean create)
                                      throws IgniteCheckedException

Gets an atomic long from cache or creates one if it's not cached.

Parameters:
  `name` - Name of atomic long.
  `initVal` - Initial value for atomic long. If atomic long already cached, `initVal` will be ignored.
  `create` - If `true` atomic long will be created in case it is not in cache.
Returns:
  Atomic long.
Throws:
  `IgniteCheckedException` - If loading failed.

#### atomicReference

    public final <T> IgniteAtomicReference<T> atomicReference(String name,
                                               T initVal,
                                               boolean create)
                                                   throws IgniteCheckedException

Gets an atomic reference from cache or creates one if it's not cached.

Parameters:
  `name` - Name of atomic reference.
  `initVal` - Initial value for atomic reference. If atomic reference already cached, `initVal` will be ignored.
  `create` - If `true` atomic reference will be created in case it is not in cache.
Returns:
  Atomic reference.
Throws:
  `IgniteCheckedException` - If loading failed.

#### atomicStamped

    public final <T,S> IgniteAtomicStamped<T,S> atomicStamped(String name,
                                               T initVal,
                                               S initStamp,
                                               boolean create)
                                                 throws IgniteCheckedException

Gets an atomic stamped from cache or creates one if it's not cached.

Parameters:
  `name` - Name of atomic stamped.
  `initVal` - Initial value for atomic stamped. If atomic stamped already cached, `initVal` will be ignored.
  `initStamp` - Initial stamp for atomic stamped. If atomic stamped already cached, `initStamp` will be ignored.
  `create` - If `true` atomic stamped will be created in case it is not in cache.
Returns:
  Atomic stamped.
Throws:
  `IgniteCheckedException` - If loading failed.

#### queue

    public final <T> IgniteQueue<T> queue(String name,
                           int cap,
                           @Nullable
                           CollectionConfiguration cfg)
                               throws IgniteCheckedException

Gets a queue from cache or creates one if it's not cached.

Parameters:
  `name` - Name of queue.
  `cap` - Max size of queue.
  `cfg` - Non-null queue configuration if new queue should be created.
Returns:
  Instance of queue.
Throws:
  `IgniteCheckedException` - If failed.

#### removeQueue

    public void removeQueue(String name,
                   GridCacheContext cctx)
                     throws IgniteCheckedException

Parameters:
  `name` - Queue name.
  `cctx` - Queue cache context.
Throws:
  `IgniteCheckedException` - If failed.

#### countDownLatch

    public IgniteCountDownLatch countDownLatch(String name,
                                      int cnt,
                                      boolean autoDel,
                                      boolean create)
                                        throws IgniteCheckedException

Gets or creates count down latch. If count down latch is not found in cache, it is created using provided name and count parameter.

Parameters:
  `name` - Name of the latch.
  `cnt` - Initial count.
  `autoDel` - `True` to automatically delete latch from cache when its count reaches zero.
  `create` - If `true` latch will be created in case it is not in cache, if it is `false` all parameters except `name` are ignored.
Returns:
  Count down latch for the given name or `null` if it is not found and `create` is false.
Throws:
  `IgniteCheckedException` - If operation failed.

#### removeCountDownLatch

    public void removeCountDownLatch(String name)
                              throws IgniteCheckedException

Removes count down latch from cache.

Parameters:
  `name` - Name of the latch.
Throws:
  `IgniteCheckedException` - If operation failed.

#### semaphore

    public IgniteSemaphore semaphore(String name,
                            int cnt,
                            boolean failoverSafe,
                            boolean create)
                              throws IgniteCheckedException

Gets or creates semaphore. If semaphore is not found in cache, it is created using provided name and count parameter.

Parameters:
  `name` - Name of the semaphore.
  `cnt` - Initial count.
  `failoverSafe` - `True` FailoverSafe parameter.
  `create` - If `true` semaphore will be created in case it is not in cache, if it is `false` all parameters except `name` are ignored.
Returns:
  Semaphore for the given name or `null` if it is not found and `create` is false.
Throws:
  `IgniteCheckedException` - If operation failed.

#### removeSemaphore

    public void removeSemaphore(String name)
                         throws IgniteCheckedException

Removes semaphore from cache.

Parameters:
  `name` - Name of the semaphore.
Throws:
  `IgniteCheckedException` - If operation failed.

#### reentrantLock

    public IgniteLock reentrantLock(String name,
                           boolean failoverSafe,
                           boolean fair,
                           boolean create)
                             throws IgniteCheckedException

Gets or creates reentrant lock. If reentrant lock is not found in cache, it is created using provided name, failover mode, and fairness mode parameters.

Parameters:
  `name` - Name of the reentrant lock.
  `failoverSafe` - Flag indicating behaviour in case of failure.
  `fair` - Flag indicating fairness policy of this lock.
  `create` - If `true` reentrant lock will be created in case it is not in cache.
Returns:
  ReentrantLock for the given name or `null` if it is not found and `create` is false.
Throws:
  `IgniteCheckedException` - If operation failed.

#### removeReentrantLock

    public void removeReentrantLock(String name,
                           boolean broken)
                             throws IgniteCheckedException

Removes reentrant lock from cache.

Parameters:
  `name` - Name of the reentrant lock.
  `broken` - Flag indicating the reentrant lock is broken and should be removed unconditionally.
Throws:
  `IgniteCheckedException` - If operation failed.

#### set

    @Nullable
    public <T> IgniteSet<T> set(String name,
                                @Nullable
                                CollectionConfiguration cfg)
                     throws IgniteCheckedException

Gets a set from cache or creates one if it's not cached.

Parameters:
  `name` - Set name.
  `cfg` - Set configuration if new set should be created.
Returns:
  Set instance.
Throws:
  `IgniteCheckedException` - If failed.

#### removeSet

    public void removeSet(String name,
                 GridCacheContext cctx)
                   throws IgniteCheckedException

Parameters:
  `name` - Set name.
  `cctx` - Set cache context.
Throws:
  `IgniteCheckedException` - If failed.

#### retry

    public static <R> R retry(IgniteLogger log,
              Callable<R> call)
                   throws IgniteCheckedException

Parameters:
  `log` - Logger.
  `call` - Callable.
Returns:
  Callable result.
Throws:
  `IgniteCheckedException` - If all retries failed.

#### printMemoryStats

    public void printMemoryStats()

Prints memory statistics (sizes of internal structures, etc.). NOTE: this method is for testing and profiling purposes only.

Specified by:
  `printMemoryStats` in interface `GridComponent`
Overrides:
  `printMemoryStats` in class `GridProcessorAdapter`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.0.0
Release Date | : April 30 2017