/** {@inheritDoc} */ @Override public void visit(SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException { assert clo != null; List<GridDhtLocalPartition> parts = cctx.topology().localPartitions(); if (parts.isEmpty()) return; GridCompoundFuture<Void, Void> fut = null; if (parallelism > 1) { fut = new GridCompoundFuture<>(); for (int i = 1; i < parallelism; i++) fut.add(processPartitionsAsync(parts, clo, i)); fut.markInitialized(); } processPartitions(parts, clo, 0); if (fut != null) fut.get(); }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(GridCompoundFuture.class, this, "done", isDone(), "cancelled", isCancelled(), "err", error(), "futs", F.viewReadOnly(futures(), new C1<IgniteInternalFuture<T>, String>() { @Override public String apply(IgniteInternalFuture<T> f) { return Boolean.toString(f.isDone()); } }) ); } }
/** * Check completeness of the future. */ private void checkComplete() { if (initialized() && !isDone() && lsnrCalls == futuresCount()) { try { onDone(rdc != null ? rdc.reduce() : null); } catch (RuntimeException e) { logError(logger(), "Failed to execute compound future reducer: " + this, e); onDone(e); } catch (AssertionError e) { logError(logger(), "Failed to execute compound future reducer: " + this, e); onDone(e); throw e; } } }
/** * Starts cache stop request as cache change batch. * * @param reqs cache stop requests. * @return compound future. */ @NotNull public IgniteInternalFuture<?> dynamicChangeCaches(List<DynamicCacheChangeRequest> reqs) { GridCompoundFuture<?, ?> compoundFut = new GridCompoundFuture<>(); for (DynamicCacheStartFuture fut : initiateCacheChanges(reqs)) compoundFut.add((IgniteInternalFuture)fut); compoundFut.markInitialized(); return compoundFut; }
/** * * @return Finish update future. */ public IgniteInternalFuture<?> finishDataStreamerUpdates(AffinityTopologyVersion topVer) { GridCompoundFuture<Void, Object> res = new CacheObjectsReleaseFuture<>("DataStreamer", topVer); for (DataStreamerFuture fut : dataStreamerFuts) { if (fut.topVer.compareTo(topVer) < 0) res.add(fut); } res.markInitialized(); return res; }
new HashSet<Object>(ctx.cache().publicCacheNames()) : new HashSet<>(map.keySet()); GridCompoundFuture compFut = new GridCompoundFuture(); compFut.add(executeCommand(req.destinationId(), req.clientId(), (String)cName, cacheFlags, key, new RemoveAllCommand(null))); compFut.markInitialized(); fut = compFut.chain(new CX1<GridCompoundFuture<GridCacheRestResponse, ?>, GridRestResponse>() { @Override public GridRestResponse applyx( GridCompoundFuture<GridCacheRestResponse, ?> cf) throws IgniteCheckedException {
return new GridFinishedFuture<>(); GridCompoundFuture res = new GridCompoundFuture<>(); res.add(new GridFinishedFuture<>(err)); res.add(old); res.add(fut); res.onDone(e); res.markInitialized();
/** * @param fut Child future. * @param own If {@code true}, then corresponding service will be cancelled on failure. */ public void add(GridServiceDeploymentFuture<T> fut, boolean own) { super.add(fut); if (own) { if (svcsToRollback == null) svcsToRollback = new ArrayList<>(); svcsToRollback.add(fut.serviceId()); } }
opFut.listen(lsnr); futs = buf.update(entriesForNode, topVer, assignments, opFut, remap); opFut.markInitialized();
new GridCompoundFuture<>(CU.<ClusterStartNodeResult>objectsReducer());
/** * Adds a future to this compound future. * * @param fut Future to add. */ public final void add(IgniteInternalFuture<T> fut) { assert fut != null; synchronized (this) { if (futs == null) futs = fut; else if (futs instanceof IgniteInternalFuture) { Collection<IgniteInternalFuture> futs0 = new ArrayList<>(4); futs0.add((IgniteInternalFuture)futs); futs0.add(fut); futs = futs0; } else ((Collection<IgniteInternalFuture>)futs).add(fut); } fut.listen(this); if (isCancelled()) { try { fut.cancel(); } catch (IgniteCheckedException e) { onDone(e); } } }
/** * Creates multi update finish future. Will return {@code null} if no multi-update locks are found. * * @param topVer Topology version. * @return Finish future. */ @Nullable public IgniteInternalFuture<?> multiUpdateFinishFuture(AffinityTopologyVersion topVer) { GridCompoundFuture<IgniteUuid, Object> fut = null; for (MultiUpdateFuture multiFut : multiTxFuts.values()) { if (multiFut.topologyVersion().compareTo(topVer) <= 0) { if (fut == null) fut = new GridCompoundFuture<>(); fut.add(multiFut); } } if (fut != null) fut.markInitialized(); return fut; }
/** * @param topVer Topology version to finish. * * @return Finish update future. */ @SuppressWarnings("unchecked") public IgniteInternalFuture<?> finishAtomicUpdates(AffinityTopologyVersion topVer) { GridCompoundFuture<Object, Object> res = new FinishAtomicUpdateFuture("AtomicUpdate", topVer); for (GridCacheAtomicFuture<?> fut : atomicFuts.values()) { IgniteInternalFuture<Void> complete = fut.completeFuture(topVer); if (complete != null) res.add((IgniteInternalFuture)complete); } res.markInitialized(); return res; }
new HashSet<Object>(ctx.cache().publicCacheNames()) : new HashSet<>(map.keySet()); GridCompoundFuture compFut = new GridCompoundFuture(); compFut.add(executeCommand(req.destinationId(), req.clientId(), (String)cName, cacheFlags, key, new RemoveAllCommand(null))); compFut.markInitialized(); fut = compFut.chain(new CX1<GridCompoundFuture<GridCacheRestResponse, ?>, GridRestResponse>() { @Override public GridRestResponse applyx( GridCompoundFuture<GridCacheRestResponse, ?> cf) throws IgniteCheckedException {
forcedRebFut.add(fut);
/** * Check completeness of the future. */ private void checkComplete() { if (initialized() && !isDone() && lsnrCalls == futuresCount()) { try { onDone(rdc != null ? rdc.reduce() : null); } catch (RuntimeException e) { logError(logger(), "Failed to execute compound future reducer: " + this, e); onDone(e); } catch (AssertionError e) { logError(logger(), "Failed to execute compound future reducer: " + this, e); onDone(e); throw e; } } }
opFut.listen(lsnr); futs = buf.update(entriesForNode, topVer, assignments, opFut, remap); opFut.markInitialized();
new GridCompoundFuture<>(CU.<ClusterStartNodeResult>objectsReducer());