Package 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 String` `ATOMICS_CACHE_NAME` Atomics system cache name.
`static String` `DEFAULT_DS_GROUP_NAME`
`static String` `DEFAULT_VOLATILE_DS_GROUP_NAME`
`static String` `LATCHES_VIEW`
`static String` `LOCKS_VIEW`
`static String` `LONGS_VIEW`
`static String` `QUEUES_VIEW`
`static String` `REFERENCES_VIEW`
`static String` `SEMAPHORES_VIEW`
`static String` `SEQUENCES_VIEW`
`static String` `SETS_VIEW`
`static String` `STAMPED_VIEW`
`static String` `VOLATILE_DATA_REGION_NAME` DataRegionConfiguration name reserved for volatile caches.

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

`ctx, diagnosticLog, log`

### Constructor Summary

Constructors
`DataStructuresProcessor​(GridKernalContext ctx)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`IgniteAtomicLong` `atomicLong​(String name, @Nullable AtomicConfiguration cfg, long initVal, boolean create)` Gets an atomic long from cache or creates one if it's not cached.
`<T> IgniteAtomicReference<T>` `atomicReference​(String name, @Nullable AtomicConfiguration cfg, 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, @Nullable AtomicConfiguration cfg, T initVal, S initStamp, boolean create)` Gets an atomic stamped from cache or creates one if it's not cached.
`IgniteCountDownLatch` `countDownLatch​(String name, @Nullable AtomicConfiguration cfg, int cnt, boolean autoDel, boolean create)` Gets or creates count down latch.
`static boolean` `isDataStructureCache​(String cacheName)`
`static boolean` `isReservedGroup​(@Nullable String grpName)`
`void` `onActivate​(GridKernalContext ctx)` Called when cluster performing activation.
`void` `onBeforeActivate()`
`void` `onDeActivate​(GridKernalContext ctx)` Called when cluster performing deactivation.
`void` `onKernalStart​(boolean active)` 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, @Nullable String grpName, int cap, @Nullable CollectionConfiguration cfg)` Gets a queue from cache or creates one if it's not cached.
`IgniteLock` `reentrantLock​(String name, @Nullable AtomicConfiguration cfg, boolean failoverSafe, boolean fair, boolean create)` Gets or creates reentrant lock.
`void` `removeCountDownLatch​(String name, String grpName)` Removes count down latch from cache.
`void` `removeQueue​(String name, GridCacheContext cctx)`
`void` `removeReentrantLock​(String name, String grpName, boolean broken)` Removes reentrant lock from cache.
`void` `removeSemaphore​(String name, String grpName)` Removes semaphore from cache.
`void` `removeSet​(String name, GridCacheContext cctx)`
`void` `restart​(String cacheName, IgniteInternalCache cache)` Would return this cache to normal work if it was suspened (and if it is atomics cache).
`void` `restoreStructuresState​(GridKernalContext ctx)`
`static <R> R` `retry​(IgniteLogger log, Callable<R> call)`
`IgniteSemaphore` `semaphore​(String name, @Nullable AtomicConfiguration cfg, int cnt, boolean failoverSafe, boolean create)` Gets or creates semaphore.
`IgniteAtomicSequence` `sequence​(String name, @Nullable AtomicConfiguration cfg, long initVal, boolean create)` Gets a sequence from cache or creates one if it's not cached.
`<T> @Nullable IgniteSet<T>` `set​(String name, int cacheId, boolean collocated, boolean separated)` Gets a set from cache by known cache id.
`<T> @Nullable IgniteSet<T>` `set​(String name, @Nullable String grpName, @Nullable CollectionConfiguration cfg)` Gets a set from cache or creates one if it's not cached.
`void` `start()` Starts grid component.
`void` `suspend​(String cacheName)` Would suspend calls for this cache if it is atomics cache.

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

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

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

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

### Field Detail

#### VOLATILE_DATA_REGION_NAME

    public static final String VOLATILE_DATA_REGION_NAME

DataRegionConfiguration name reserved for volatile caches.

See Also:
  Constant Field Values

#### DEFAULT_VOLATILE_DS_GROUP_NAME

    public static final String DEFAULT_VOLATILE_DS_GROUP_NAME

See Also:
  Constant Field Values

#### DEFAULT_DS_GROUP_NAME

    public static final String DEFAULT_DS_GROUP_NAME

See Also:
  Constant Field Values

#### ATOMICS_CACHE_NAME

    public static final String ATOMICS_CACHE_NAME

Atomics system cache name.

See Also:
  Constant Field Values

#### QUEUES_VIEW

    public static final String QUEUES_VIEW

#### SETS_VIEW

    public static final String SETS_VIEW

#### LOCKS_VIEW

    public static final String LOCKS_VIEW

#### SEMAPHORES_VIEW

    public static final String SEMAPHORES_VIEW

#### LATCHES_VIEW

    public static final String LATCHES_VIEW

#### STAMPED_VIEW

    public static final String STAMPED_VIEW

#### REFERENCES_VIEW

    public static final String REFERENCES_VIEW

#### LONGS_VIEW

    public static final String LONGS_VIEW

#### SEQUENCES_VIEW

    public static final String SEQUENCES_VIEW

### Constructor Detail

#### DataStructuresProcessor

    public DataStructuresProcessor​(GridKernalContext ctx)

Parameters:
  `ctx` - Context.

### Method Detail

#### start

    public void start()

Starts grid component.

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

#### onKernalStart

    public void onKernalStart​(boolean active)

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

Specified by:
  `onKernalStart` in interface `GridComponent`
Overrides:
  `onKernalStart` in class `GridProcessorAdapter`
Parameters:
  `active` - Cluster active flag (note: should be used carefully since state can change concurrently).

#### onBeforeActivate

    public void onBeforeActivate()

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

Called when cluster performing activation.

Specified by:
  `onActivate` in interface `IgniteChangeGlobalStateSupport`
Parameters:
  `ctx` - Kernal context.

#### restoreStructuresState

    public void restoreStructuresState​(GridKernalContext ctx)

Parameters:
  `ctx` - Context.

#### onDeActivate

    public void onDeActivate​(GridKernalContext ctx)

Called when cluster performing deactivation.

Specified by:
  `onDeActivate` in interface `IgniteChangeGlobalStateSupport`
Parameters:
  `ctx` - Kernal context.

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

#### isDataStructureCache

    public static boolean isDataStructureCache​(String cacheName)

Parameters:
  `cacheName` - Cache name.
Returns:
  `True` if cache with such name is used to store data structures.

#### isReservedGroup

    public static boolean isReservedGroup​(@Nullable
                                          @Nullable String grpName)

Parameters:
  `grpName` - Group name.
Returns:
  `True` if group name is reserved to store data structures.

#### sequence

    public final IgniteAtomicSequence sequence​(String name,
                                               @Nullable
                                               @Nullable AtomicConfiguration cfg,
                                               long initVal,
                                               boolean create)
                                        throws IgniteCheckedException

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

Parameters:
  `name` - Sequence name.
  `cfg` - Configuration.
  `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,
                                             @Nullable
                                             @Nullable AtomicConfiguration cfg,
                                             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.
  `cfg` - Configuration.
  `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.

#### suspend

    public void suspend​(String cacheName)

Would suspend calls for this cache if it is atomics cache.

Parameters:
  `cacheName` - To suspend.

#### restart

    public void restart​(String cacheName,
                        IgniteInternalCache cache)

Would return this cache to normal work if it was suspened (and if it is atomics cache).

Parameters:
  `cacheName` - To restart.

#### atomicReference

    public final <T> IgniteAtomicReference<T> atomicReference​(String name,
                                                              @Nullable
                                                              @Nullable AtomicConfiguration cfg,
                                                              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.
  `cfg` - Configuration.
  `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,
                                                                          @Nullable
                                                                          @Nullable AtomicConfiguration cfg,
                                                                          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.
  `cfg` - Configuration.
  `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,
                                          @Nullable
                                          @Nullable String grpName,
                                          int cap,
                                          @Nullable
                                          @Nullable CollectionConfiguration cfg)
                                   throws IgniteCheckedException

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

Parameters:
  `name` - Name of queue.
  `grpName` - Group name. If present, will override groupName from configuration.
  `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,
                                               @Nullable
                                               @Nullable AtomicConfiguration cfg,
                                               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.
  `cfg` - Configuration.
  `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,
                                     String grpName)
                              throws IgniteCheckedException

Removes count down latch from cache.

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

#### semaphore

    public IgniteSemaphore semaphore​(String name,
                                     @Nullable
                                     @Nullable AtomicConfiguration cfg,
                                     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.
  `cfg` - Configuration.
  `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,
                                String grpName)
                         throws IgniteCheckedException

Removes semaphore from cache.

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

#### reentrantLock

    public IgniteLock reentrantLock​(String name,
                                    @Nullable
                                    @Nullable AtomicConfiguration cfg,
                                    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.
  `cfg` - Configuration.
  `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,
                                    String grpName,
                                    boolean broken)
                             throws IgniteCheckedException

Removes reentrant lock from cache.

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

#### set

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

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

Parameters:
  `name` - Set name.
  `grpName` - Group name. If present, will override groupName from configuration.
  `cfg` - Set configuration if new set should be created.
Returns:
  Set instance.
Throws:
  `IgniteCheckedException` - If failed.

#### set

    @Nullable
    public <T> @Nullable IgniteSet<T> set​(String name,
                                          int cacheId,
                                          boolean collocated,
                                          boolean separated)
                                   throws IgniteCheckedException

Gets a set from cache by known cache id. Does not create new sets.

Parameters:
  `name` - Set name.
  `cacheId` - Cache id.
  `collocated` - Colocated mode flag.
  `separated` - Separated cache flag.
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`