Search in sources :

Example 1 with AtomicDataStructureValue

use of org.apache.ignite.internal.processors.datastructures.AtomicDataStructureValue in project ignite by apache.

the class ViewCacheClosure method collectSequences.

/**
 * @param ctx Context.
 * @param compiled Compiled pattern.
 * @param cacheInfo Cache info.
 */
private void collectSequences(GridKernalContext ctx, Pattern compiled, List<CacheInfo> cacheInfo) throws IgniteCheckedException {
    String dsCacheName = DataStructuresProcessor.ATOMICS_CACHE_NAME + "@default-ds-group";
    IgniteInternalCache<GridCacheInternalKey, AtomicDataStructureValue> cache0 = ctx.cache().cache(dsCacheName);
    final Iterator<Cache.Entry<GridCacheInternalKey, AtomicDataStructureValue>> iter = cache0.scanIterator(false, null);
    while (iter.hasNext()) {
        Cache.Entry<GridCacheInternalKey, AtomicDataStructureValue> entry = iter.next();
        final AtomicDataStructureValue val = entry.getValue();
        if (val.type() == DataStructureType.ATOMIC_SEQ) {
            final String name = entry.getKey().name();
            if (compiled.matcher(name).find()) {
                CacheInfo ci = new CacheInfo();
                ci.setSeqName(name);
                ci.setSeqVal(((GridCacheAtomicSequenceValue) val).get());
                cacheInfo.add(ci);
            }
        }
    }
}
Also used : GridCacheInternalKey(org.apache.ignite.internal.processors.datastructures.GridCacheInternalKey) AtomicDataStructureValue(org.apache.ignite.internal.processors.datastructures.AtomicDataStructureValue) Cache(javax.cache.Cache) IgniteInternalCache(org.apache.ignite.internal.processors.cache.IgniteInternalCache)

Aggregations

Cache (javax.cache.Cache)1 IgniteInternalCache (org.apache.ignite.internal.processors.cache.IgniteInternalCache)1 AtomicDataStructureValue (org.apache.ignite.internal.processors.datastructures.AtomicDataStructureValue)1 GridCacheInternalKey (org.apache.ignite.internal.processors.datastructures.GridCacheInternalKey)1