Search in sources :

Example 1 with GridDhtFuture

use of org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtFuture in project ignite by apache.

the class GridDhtPreloader method request0.

/**
     * @param keys Keys to request.
     * @param topVer Topology version.
     * @return Future for request.
     */
@SuppressWarnings({ "unchecked", "RedundantCast" })
private GridDhtFuture<Object> request0(Collection<KeyCacheObject> keys, AffinityTopologyVersion topVer) {
    final GridDhtForceKeysFuture<?, ?> fut = new GridDhtForceKeysFuture<>(cctx, topVer, keys, this);
    IgniteInternalFuture<?> topReadyFut = cctx.affinity().affinityReadyFuturex(topVer);
    if (startFut.isDone() && topReadyFut == null)
        fut.init();
    else {
        if (topReadyFut == null)
            startFut.listen(new CI1<IgniteInternalFuture<?>>() {

                @Override
                public void apply(IgniteInternalFuture<?> syncFut) {
                    cctx.kernalContext().closure().runLocalSafe(new GridPlainRunnable() {

                        @Override
                        public void run() {
                            fut.init();
                        }
                    });
                }
            });
        else {
            GridCompoundFuture<Object, Object> compound = new GridCompoundFuture<>();
            compound.add((IgniteInternalFuture<Object>) startFut);
            compound.add((IgniteInternalFuture<Object>) topReadyFut);
            compound.markInitialized();
            compound.listen(new CI1<IgniteInternalFuture<?>>() {

                @Override
                public void apply(IgniteInternalFuture<?> syncFut) {
                    fut.init();
                }
            });
        }
    }
    return (GridDhtFuture) fut;
}
Also used : GridDhtFuture(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtFuture) CI1(org.apache.ignite.internal.util.typedef.CI1) KeyCacheObject(org.apache.ignite.internal.processors.cache.KeyCacheObject) IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) GridPlainRunnable(org.apache.ignite.internal.util.lang.GridPlainRunnable) GridCompoundFuture(org.apache.ignite.internal.util.future.GridCompoundFuture)

Aggregations

IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)1 KeyCacheObject (org.apache.ignite.internal.processors.cache.KeyCacheObject)1 GridDhtFuture (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtFuture)1 GridCompoundFuture (org.apache.ignite.internal.util.future.GridCompoundFuture)1 GridPlainRunnable (org.apache.ignite.internal.util.lang.GridPlainRunnable)1 CI1 (org.apache.ignite.internal.util.typedef.CI1)1