/** {@inheritDoc} */ @Override public Set<UUID> pendingResponseNodes() { if (initialized() && !isDone()) { return futures().stream() .map(MiniFuture.class::cast) .filter(mini -> !mini.isDone()) .map(mini -> mini.node.id()) .collect(Collectors.toSet()); } return Collections.emptySet(); }
/** * @param nodeId Left node ID * @return {@code True} if node was in the list. */ @Override public synchronized boolean onNodeLeft(UUID nodeId) { for (IgniteInternalFuture<?> fut : futures()) { MiniFuture f = (MiniFuture)fut; if (f.node.id().equals(nodeId)) { if (log.isDebugEnabled()) log.debug("Found mini-future for left node [nodeId=" + nodeId + ", mini=" + f + ", fut=" + this + ']'); return f.onResult(null, newTopologyException(nodeId)); } } if (log.isDebugEnabled()) log.debug("Future does not have mapping for left node (ignoring) [nodeId=" + nodeId + ", fut=" + this + ']'); return false; }
add(new MiniFuture(cctx.localNode())); add(mini = new MiniFuture(node)); mini.onResult(null, e); else onDone(e);
/** * @param res Response. * @param err Exception. * @return {@code True} if future was completed by this call. */ public boolean onResult(GridNearTxQueryEnlistResponse res, Throwable err) { assert res != null || err != null : this; if (err == null && res.error() != null) err = res.error(); synchronized (this) { if (completed) return false; completed = true; } if (res != null && res.removeMapping()) { GridDistributedTxMapping m = tx.mappings().get(node.id()); assert m != null && m.empty(); tx.removeMapping(node.id()); if (node.isLocal()) tx.colocatedLocallyMapped(false); } else if (res != null) { tx.mappings().get(node.id()).addBackups(res.newDhtNodes()); if (res.result() > 0 && !node.isLocal()) tx.hasRemoteLocks(true); } return err != null ? onDone(err) : onDone(res.result(), res.error()); } }
/** * @param nodeId Left node ID * @return {@code True} if node was in the list. */ @Override public synchronized boolean onNodeLeft(UUID nodeId) { for (IgniteInternalFuture<?> fut : futures()) { MiniFuture f = (MiniFuture)fut; if (f.node.id().equals(nodeId)) { if (log.isDebugEnabled()) log.debug("Found mini-future for left node [nodeId=" + nodeId + ", mini=" + f + ", fut=" + this + ']'); return f.onResult(null, newTopologyException(nodeId)); } } if (log.isDebugEnabled()) log.debug("Future does not have mapping for left node (ignoring) [nodeId=" + nodeId + ", fut=" + this + ']'); return false; }
@Override public void apply(IgniteInternalFuture<Long> fut) { assert fut.error() != null || fut.result() != null : fut; try { clearLocalFuture((GridDhtTxQueryEnlistFuture)fut); GridNearTxQueryEnlistResponse res = fut.error() == null ? createResponse(fut) : null; localMini.onResult(res, fut.error()); } catch (IgniteCheckedException e) { localMini.onResult(null, e); } finally { CU.unwindEvicts(cctx); } } });
/** * @param nodeId Sender node id. * @param res Response. */ public void onResult(UUID nodeId, GridNearTxQueryEnlistResponse res) { MiniFuture mini = miniFuture(res.miniId()); if (mini != null) mini.onResult(res, null); }
@Override public void apply(IgniteInternalFuture<?> f) { try { cctx.io().send(nodeId, req, cctx.ioPolicy()); } catch (IgniteCheckedException e) { fut.onResult(null, e); } } });
add(new MiniFuture(cctx.localNode())); add(mini = new MiniFuture(node)); mini.onResult(null, e); else onDone(e);
/** * @param res Response. * @param err Exception. * @return {@code True} if future was completed by this call. */ public boolean onResult(GridNearTxQueryEnlistResponse res, Throwable err) { assert res != null || err != null : this; if (err == null && res.error() != null) err = res.error(); synchronized (this) { if (completed) return false; completed = true; } if (res != null && res.removeMapping()) { GridDistributedTxMapping m = tx.mappings().get(node.id()); assert m != null && m.empty(); tx.removeMapping(node.id()); if (node.isLocal()) tx.colocatedLocallyMapped(false); } else if (res != null) { tx.mappings().get(node.id()).addBackups(res.newDhtNodes()); if (res.result() > 0 && !node.isLocal()) tx.hasRemoteLocks(true); } return err != null ? onDone(err) : onDone(res.result(), res.error()); } }
@Override public void apply(IgniteInternalFuture<Long> fut) { assert fut.error() != null || fut.result() != null : fut; try { clearLocalFuture((GridDhtTxQueryEnlistFuture)fut); GridNearTxQueryEnlistResponse res = fut.error() == null ? createResponse(fut) : null; localMini.onResult(res, fut.error()); } catch (IgniteCheckedException e) { localMini.onResult(null, e); } finally { CU.unwindEvicts(cctx); } } });
/** * @param nodeId Sender node id. * @param res Response. */ public void onResult(UUID nodeId, GridNearTxQueryEnlistResponse res) { MiniFuture mini = miniFuture(res.miniId()); if (mini != null) mini.onResult(res, null); }
@Override public void apply(IgniteInternalFuture<?> f) { try { cctx.io().send(nodeId, req, cctx.ioPolicy()); } catch (IgniteCheckedException e) { fut.onResult(null, e); } } });