use of org.apache.ignite.internal.processors.datastructures.GridCacheSetProxy in project ignite by apache.
the class CacheDataStructuresManager method onReconnected.
/**
* @param clusterRestarted Cluster restarted flag.
* @throws IgniteCheckedException If failed.
*/
public void onReconnected(boolean clusterRestarted) throws IgniteCheckedException {
for (Map.Entry<IgniteUuid, GridCacheSetProxy> e : setsMap.entrySet()) {
GridCacheSetProxy set = e.getValue();
if (clusterRestarted) {
set.blockOnRemove();
setsMap.remove(e.getKey(), set);
} else
set.needCheckNotRemoved();
}
for (Map.Entry<IgniteUuid, GridCacheQueueProxy> e : queuesMap.entrySet()) {
GridCacheQueueProxy queue = e.getValue();
if (clusterRestarted) {
queue.delegate().onRemoved(false);
queuesMap.remove(e.getKey(), queue);
}
}
}
use of org.apache.ignite.internal.processors.datastructures.GridCacheSetProxy in project ignite by apache.
the class CacheDataStructuresManager method set0.
/**
* @param name Name of set.
* @param collocated Collocation flag.
* @param create If {@code true} set will be created in case it is not in cache.
* @return Set.
* @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("unchecked")
@Nullable
private <T> IgniteSet<T> set0(String name, boolean collocated, boolean create) throws IgniteCheckedException {
cctx.gate().enter();
try {
GridCacheSetHeaderKey key = new GridCacheSetHeaderKey(name);
GridCacheSetHeader hdr;
IgniteInternalCache cache = cctx.cache().withNoRetries();
if (create) {
hdr = new GridCacheSetHeader(IgniteUuid.randomUuid(), collocated);
GridCacheSetHeader old = (GridCacheSetHeader) cache.getAndPutIfAbsent(key, hdr);
if (old != null)
hdr = old;
} else
hdr = (GridCacheSetHeader) cache.get(key);
if (hdr == null)
return null;
GridCacheSetProxy<T> set = setsMap.get(hdr.id());
if (set == null) {
GridCacheSetProxy<T> old = setsMap.putIfAbsent(hdr.id(), set = new GridCacheSetProxy<>(cctx, new GridCacheSetImpl<T>(cctx, name, hdr)));
if (old != null)
set = old;
}
return set;
} finally {
cctx.gate().leave();
}
}
Aggregations