Search in sources :

Example 6 with CacheStoppedException

use of org.apache.ignite.internal.processors.cache.CacheStoppedException in project ignite by apache.

the class IgniteTxStateImpl method topologyReadLock.

/**
 * {@inheritDoc}
 */
@Override
public GridDhtTopologyFuture topologyReadLock(GridCacheSharedContext cctx, GridFutureAdapter<?> fut) {
    if (activeCacheIds.isEmpty())
        return cctx.exchange().lastTopologyFuture();
    GridCacheContext<?, ?> nonLocCtx = null;
    for (int i = 0; i < activeCacheIds.size(); i++) {
        int cacheId = activeCacheIds.get(i);
        GridCacheContext<?, ?> cacheCtx = cctx.cacheContext(cacheId);
        if (!cacheCtx.isLocal()) {
            nonLocCtx = cacheCtx;
            break;
        }
    }
    if (nonLocCtx == null)
        return cctx.exchange().lastTopologyFuture();
    nonLocCtx.topology().readLock();
    if (nonLocCtx.topology().stopping()) {
        fut.onDone(new CacheStoppedException(nonLocCtx.name()));
        return null;
    }
    return nonLocCtx.topology().topologyVersionFuture();
}
Also used : CacheStoppedException(org.apache.ignite.internal.processors.cache.CacheStoppedException)

Aggregations

CacheStoppedException (org.apache.ignite.internal.processors.cache.CacheStoppedException)6 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)4 AffinityTopologyVersion (org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion)4 GridDhtTopologyFuture (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture)4 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 GridCacheEntryRemovedException (org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException)1 IgniteCacheExpiryPolicy (org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy)1 GridDhtCacheEntry (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry)1 GridDhtInvalidPartitionException (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException)1 GridDhtPartitionTopology (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology)1 GridCacheVersion (org.apache.ignite.internal.processors.cache.version.GridCacheVersion)1 IgniteBiTuple (org.apache.ignite.lang.IgniteBiTuple)1