/** * @param err Error. */ public IgniteFinishedFutureImpl(Throwable err) { super(new GridFinishedFuture<V>(err)); }
/** * @param err Error. */ public IgniteFinishedCacheFutureImpl(Throwable err) { super(new GridFinishedFuture<V>(err)); } }
/** * @param res Result. */ public IgniteFinishedFutureImpl(V res) { super(new GridFinishedFuture<>(res)); }
/** * */ public IgniteFinishedFutureImpl() { super(new GridFinishedFuture<>((V)null)); }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<IgniteInternalTx> commitAsync() { try { commitRemoteTx(); return new GridFinishedFuture<IgniteInternalTx>(this); } catch (IgniteCheckedException e) { return new GridFinishedFuture<>(e); } }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<Boolean> lockAllAsync(@Nullable Collection<? extends K> keys, long timeout) { return new GridFinishedFuture<>(new UnsupportedOperationException("Locks are not supported for " + "CacheAtomicityMode.ATOMIC mode (use CacheAtomicityMode.TRANSACTIONAL instead)")); }
/** {@inheritDoc} */ @Override public <R> IgniteInternalFuture<R> chain(final IgniteClosure<? super IgniteInternalFuture<T>, R> doneCb) { try { return new GridFinishedFuture<>(doneCb.apply(this)); } catch (GridClosureException e) { return new GridFinishedFuture<>(e.unwrap()); } catch (RuntimeException | Error e) { return new GridFinishedFuture<>(e); } }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<IgniteInternalTx> rollbackAsync() { rollbackRemoteTx(); return new GridFinishedFuture<IgniteInternalTx>(this); }
/** * @param grp Cache group. */ public GridCachePreloaderAdapter(CacheGroupContext grp) { assert grp != null; this.grp = grp; ctx = grp.shared(); log = ctx.logger(getClass()); finFut = new GridFinishedFuture(); }
/** * Create future with error. * * @param errMsg Error message. * @return Future. */ @SuppressWarnings("Convert2Diamond") private static IgniteInternalFuture<Boolean> errorFuture(String errMsg) { return new GridFinishedFuture<Boolean>(new IgniteCheckedException(errMsg)); }
/** * @return Finished future with error message about tx type mismatch. */ private static IgniteInternalFuture txTypeMismatchFinishFuture() { return new GridFinishedFuture(new IgniteCheckedException(TX_TYPE_MISMATCH_ERR_MSG)); }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<?> putAllAsync(final Map<? extends K, ? extends V> m) { if (F.isEmpty(m)) return new GridFinishedFuture<Object>(); if (keyCheck) validateCacheKeys(m.keySet()); return putAllAsync0(m); }
/** * Gets affinity ready future, a future that will be completed after affinity with given * topology version is calculated. * * @param topVer Topology version to wait. * @return Affinity ready future. */ public IgniteInternalFuture<AffinityTopologyVersion> affinityReadyFuture(AffinityTopologyVersion topVer) { assert !cctx.isLocal(); IgniteInternalFuture<AffinityTopologyVersion> fut = aff.readyFuture(topVer); return fut != null ? fut : new GridFinishedFuture<>(aff.lastVersion()); }
/** * Gets ready future for the next affinity topology version (used in cases when a node leaves grid). * * @param curVer Current topology version (before a node left grid). * @return Ready future. */ public IgniteInternalFuture<?> nextAffinityReadyFuture(AffinityTopologyVersion curVer) { if (curVer == null) return null; AffinityTopologyVersion nextVer = new AffinityTopologyVersion(curVer.topologyVersion() + 1); IgniteInternalFuture<?> fut = exchMgr.affinityReadyFuture(nextVer); return fut == null ? new GridFinishedFuture<>() : fut; }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<IgniteInternalTx> apply(IgniteInternalTx tx, IgniteTxManager tm) { return tx.isRollbackOnly() || tx.state() == COMMITTING || tx.state() == COMMITTED ? new GridFinishedFuture<>() : ((GridDhtTxLocal)tx).rollbackDhtLocalAsync(); } }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<IgniteInternalTx> apply(IgniteInternalTx tx, IgniteTxManager tm) { return tx.isRollbackOnly() || tx.state() == COMMITTING || tx.state() == COMMITTED ? new GridFinishedFuture<>() : ((GridNearTxLocal)tx).rollbackNearTxLocalAsync(false, false); } }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<Void> ackTxCommit(MvccSnapshot updateVer) { assert updateVer != null; MvccCoordinator crd = curCrd; if (crd.disconnected() || crd.version() != updateVer.coordinatorVersion()) return new GridFinishedFuture<>(); return sendTxCommit(crd, new MvccAckRequestTx(futIdCntr.incrementAndGet(), updateVer.counter())); }
/** * @param ctx Context. * @param nodeId Target node ID. * @return Communication information future. */ public static IgniteInternalFuture<String> dumpCommunicationInfo(GridKernalContext ctx, UUID nodeId) { if (ctx.config().getCommunicationSpi() instanceof TcpCommunicationSpi) return ((TcpCommunicationSpi) ctx.config().getCommunicationSpi()).dumpNodeStatistics(nodeId); else return new GridFinishedFuture<>("Unexpected communication SPI: " + ctx.config().getCommunicationSpi()); }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<?> applyx(IgniteInternalCache<Object, Object> c, GridKernalContext ctx) { CacheMetrics metrics = c.cache().localMetrics(); assert metrics != null; return new GridFinishedFuture<Object>(new GridCacheRestMetrics( (int)metrics.getCacheGets(), (int)(metrics.getCacheRemovals() + metrics.getCachePuts()), (int)metrics.getCacheHits(), (int)metrics.getCacheMisses()) ); } }
/** * @param topVer Topology version. * @param node Node. * @return Exchange future. */ private IgniteInternalFuture<?> affinityReadyFuture(AffinityTopologyVersion topVer, Ignite node) { IgniteInternalFuture<?> fut = ((IgniteKernal)node).context().cache().context().exchange(). affinityReadyFuture(topVer); return fut != null ? fut : new GridFinishedFuture<>(); }