@Override public void apply(IgniteInternalFuture<?> f) { try { cctx.io().send(nodeId, req, cctx.ioPolicy()); } catch (IgniteCheckedException e) { fut.onResult(null, e); } } });
@Override public void apply(IgniteInternalFuture<?> fut) { cctx.io().removeOrderedHandler(false, topic); } });
@Override public void apply(IgniteInternalFuture<?> future) { try { cctx.io().send(nodeId, req, cctx.ioPolicy()); } catch (IgniteCheckedException e) { GridNearTxQueryResultsEnlistFuture.this.onDone(e); } } });
@Override public void apply(IgniteInternalFuture<?> fut) { cctx.io().removeOrderedHandler(false, topic); } });
@Override public void apply(IgniteInternalFuture<?> future) { try { cctx.io().send(nodeId, req, cctx.ioPolicy()); } catch (IgniteCheckedException e) { GridNearTxEnlistFuture.this.onDone(e); } } });
/** {@inheritDoc} */ @Override public void start() throws IgniteCheckedException { super.start(); ctx.io().addCacheHandler(ctx.cacheId(), GridNearGetResponse.class, new CI2<UUID, GridNearGetResponse>() { @Override public void apply(UUID nodeId, GridNearGetResponse res) { processGetResponse(nodeId, res); } }); ctx.io().addCacheHandler(ctx.cacheId(), GridNearLockResponse.class, new CI2<UUID, GridNearLockResponse>() { @Override public void apply(UUID nodeId, GridNearLockResponse res) { processLockResponse(nodeId, res); } }); }
@Override public void apply(IgniteInternalFuture<?> t) { try { if (log.isDebugEnabled()) log.debug("Sending near lock request [node=" + node.id() + ", req=" + req + ']'); cctx.io().send(node, req, cctx.ioPolicy()); } catch (ClusterTopologyCheckedException ex) { fut.onResult(ex); } catch (IgniteCheckedException e) { onError(e); } } });
/** {@inheritDoc} */ @Override public void start() throws IgniteCheckedException { super.start(); ctx.io().addCacheHandler(ctx.cacheId(), GridNearGetResponse.class, new CI2<UUID, GridNearGetResponse>() { @Override public void apply(UUID nodeId, GridNearGetResponse res) { processGetResponse(nodeId, res); } }); }
/** * @param req Request. */ void sendCheckUpdateRequest(GridNearAtomicCheckUpdateRequest req) { try { cctx.io().send(req.updateRequest().nodeId(), req, cctx.ioPolicy()); } catch (ClusterTopologyCheckedException e) { onSendError(req, e); } catch (IgniteCheckedException e) { completeFuture(null, e, req.futureId()); } }
/** {@inheritDoc} */ @Override public void start() throws IgniteCheckedException { super.start(); ctx.io().addCacheHandler(ctx.cacheId(), GridNearGetResponse.class, new CI2<UUID, GridNearGetResponse>() { @Override public void apply(UUID nodeId, GridNearGetResponse res) { processNearGetResponse(nodeId, res); } }); ctx.io().addCacheHandler(ctx.cacheId(), GridNearSingleGetResponse.class, new CI2<UUID, GridNearSingleGetResponse>() { @Override public void apply(UUID nodeId, GridNearSingleGetResponse res) { processNearSingleGetResponse(nodeId, res); } }); ctx.io().addCacheHandler(ctx.cacheId(), GridNearLockResponse.class, new CI2<UUID, GridNearLockResponse>() { @Override public void apply(UUID nodeId, GridNearLockResponse res) { processLockResponse(nodeId, res); } }); }
/** * @param req Request. * @param nodeId Remote node ID * @throws IgniteCheckedException if failed to send. */ private void sendRequest(GridCacheMessage req, UUID nodeId) throws IgniteCheckedException { IgniteInternalFuture<?> txSync = cctx.tm().awaitFinishAckAsync(nodeId, tx.threadId()); if (txSync == null || txSync.isDone()) cctx.io().send(nodeId, req, cctx.ioPolicy()); else txSync.listen(new CI1<IgniteInternalFuture<?>>() { @Override public void apply(IgniteInternalFuture<?> future) { try { cctx.io().send(nodeId, req, cctx.ioPolicy()); } catch (IgniteCheckedException e) { GridNearTxEnlistFuture.this.onDone(e); } } }); }
/** {@inheritDoc} */ @Override public void start() throws IgniteCheckedException { ctx.io().addCacheHandler(ctx.cacheId(), GridCacheTtlUpdateRequest.class, new CI2<UUID, GridCacheTtlUpdateRequest>() { @Override public void apply(UUID nodeId, GridCacheTtlUpdateRequest req) { processTtlUpdateRequest(req); } }); ctx.gridEvents().addLocalEventListener(discoLsnr, EVT_NODE_LEFT, EVT_NODE_FAILED); }
/** * * @param req Request. * @param nodeId Remote node ID * @throws IgniteCheckedException if failed to send. */ private void sendRequest(GridCacheMessage req, UUID nodeId) throws IgniteCheckedException { IgniteInternalFuture<?> txSync = cctx.tm().awaitFinishAckAsync(nodeId, tx.threadId()); if (txSync == null || txSync.isDone()) cctx.io().send(nodeId, req, cctx.ioPolicy()); else txSync.listen(new CI1<IgniteInternalFuture<?>>() { @Override public void apply(IgniteInternalFuture<?> future) { try { cctx.io().send(nodeId, req, cctx.ioPolicy()); } catch (IgniteCheckedException e) { GridNearTxQueryResultsEnlistFuture.this.onDone(e); } } }); }
/** * * @param req Request. * @param nodeId Remote node ID. * @param fut Result future. * @throws IgniteCheckedException if failed to send. */ private void sendRequest(GridCacheMessage req, UUID nodeId, MiniFuture fut) throws IgniteCheckedException { IgniteInternalFuture<?> txSync = cctx.tm().awaitFinishAckAsync(nodeId, tx.threadId()); if (txSync == null || txSync.isDone()) cctx.io().send(nodeId, req, QUERY_POOL); // Process query requests in query pool. else txSync.listen(new CI1<IgniteInternalFuture<?>>() { @Override public void apply(IgniteInternalFuture<?> f) { try { cctx.io().send(nodeId, req, cctx.ioPolicy()); } catch (IgniteCheckedException e) { fut.onResult(null, e); } } }); }
/** {@inheritDoc} */ @Override public void apply(IgniteInternalFuture<GridCacheReturn> fut0) { GridDhtTxAbstractEnlistFuture fut = (GridDhtTxAbstractEnlistFuture)fut0; GridCacheContext<?, ?> cctx = fut.cctx; GridDhtTxLocal tx = (GridDhtTxLocal)fut.tx; UUID nearNodeId = fut.nearNodeId; GridNearTxEnlistResponse res = createResponse(fut); try { cctx.io().send(nearNodeId, res, cctx.ioPolicy()); } catch (IgniteCheckedException e) { U.error(fut.log, "Failed to send near enlist response (will rollback transaction) [" + "tx=" + CU.txString(tx) + ", node=" + nearNodeId + ", res=" + res + ']', e); try { tx.rollbackDhtLocalAsync(); } catch (Throwable e1) { e.addSuppressed(e1); } throw new GridClosureException(e); } } }
/** {@inheritDoc} */ @Override public void start0() throws IgniteCheckedException { super.start0(); assert cctx.config().getCacheMode() != LOCAL; cctx.io().addCacheHandler(cctx.cacheId(), GridCacheQueryRequest.class, new CI2<UUID, GridCacheQueryRequest>() { @Override public void apply(UUID nodeId, GridCacheQueryRequest req) { processQueryRequest(nodeId, req); } }); lsnr = new GridLocalEventListener() { @Override public void onEvent(Event evt) { DiscoveryEvent discoEvt = (DiscoveryEvent)evt; for (GridCacheDistributedQueryFuture fut : futs.values()) fut.onNodeLeft(discoEvt.eventNode().id()); } }; cctx.events().addListener(lsnr, EVT_NODE_LEFT, EVT_NODE_FAILED); }
@Override public void apply(IgniteInternalFuture<?> t) { try { cctx.io().send(node, req, cctx.ioPolicy()); if (msgLog.isDebugEnabled()) { msgLog.debug("Collocated lock fut, sent request [txId=" + lockVer + ", inTx=" + inTx() + ", node=" + node.id() + ']'); } } catch (ClusterTopologyCheckedException ex) { assert fut != null; fut.onResult(ex); } catch (IgniteCheckedException e) { if (msgLog.isDebugEnabled()) { msgLog.debug("Collocated lock fut, failed to send request [txId=" + lockVer + ", inTx=" + inTx() + ", node=" + node.id() + ", err=" + e + ']'); } onError(e); } } });
/** {@inheritDoc} */ @Override protected void start0() throws IgniteCheckedException { // Append cache name to the topic. topicPrefix = "CONTINUOUS_QUERY" + (cctx.name() == null ? "" : "_" + cctx.name()); if (cctx.affinityNode()) { cctx.io().addCacheHandler(cctx.cacheId(), CacheContinuousQueryBatchAck.class, new CI2<UUID, CacheContinuousQueryBatchAck>() { @Override public void apply(UUID uuid, CacheContinuousQueryBatchAck msg) { CacheContinuousQueryListener lsnr = lsnrs.get(msg.routineId()); if (lsnr != null) lsnr.cleanupBackupQueue(msg.updateCntrs()); } }); cancelableTask = cctx.time().schedule(new BackupCleaner(lsnrs, cctx.kernalContext()), BACKUP_ACK_FREQ, BACKUP_ACK_FREQ); } }
/** * @param nodeId Originating node ID. * @param res Near update response. */ private void sendNearUpdateReply(UUID nodeId, GridNearAtomicUpdateResponse res) { try { ctx.io().send(nodeId, res, ctx.ioPolicy()); if (msgLog.isDebugEnabled()) msgLog.debug("Sent near update response [futId=" + res.futureId() + ", node=" + nodeId + ']'); } catch (ClusterTopologyCheckedException ignored) { if (msgLog.isDebugEnabled()) { msgLog.debug("Failed to send near update response [futId=" + res.futureId() + ", node=" + nodeId + ']'); } } catch (IgniteCheckedException e) { U.error(msgLog, "Failed to send near update response [futId=" + res.futureId() + ", node=" + nodeId + ", res=" + res + ']', e); } }
/** * @param nodeId Node ID. * @param req Request. * @param e Error. */ private void onForceKeysError(UUID nodeId, GridDhtLockRequest req, IgniteCheckedException e) { GridDhtLockResponse res = new GridDhtLockResponse(ctx.cacheId(), req.version(), req.futureId(), req.miniId(), e, ctx.deploymentEnabled()); try { ctx.io().send(nodeId, res, ctx.ioPolicy()); } catch (ClusterTopologyCheckedException ignored) { if (log.isDebugEnabled()) log.debug("Failed to send lock reply to remote node because it left grid: " + nodeId); } catch (IgniteCheckedException ignored) { U.error(log, "Failed to send lock reply to node: " + nodeId, e); } }