/** * @param reqs Requests to notify about error. */ private void notifyOnNodeLeft(SessionWriteRequest[] reqs) { IOException e = new IOException("Failed to send message, node has left: " + node.id()); IgniteException cloErr = null; for (SessionWriteRequest req : reqs) { req.onError(e); if (req.ackClosure() != null) { if (cloErr == null) cloErr = new IgniteException(e); req.ackClosure().apply(cloErr); } } }
/** * @param ses Session. * @param req Request. * @param sys System message flag. * @throws IgniteCheckedException If session was closed. */ private void send0(GridSelectorNioSessionImpl ses, SessionWriteRequest req, boolean sys) throws IgniteCheckedException { assert ses != null; assert req != null; int msgCnt = sys ? ses.offerSystemFuture(req) : ses.offerFuture(req); if (ses.closed()) { if (ses.removeFuture(req)) { IOException err = new IOException("Failed to send message (connection was closed): " + ses); req.onError(err); if (!(req instanceof GridNioFuture)) throw new IgniteCheckedException(err); } } else if (!ses.procWrite.get() && ses.procWrite.compareAndSet(false, true)) { AbstractNioClientWorker worker = (AbstractNioClientWorker)ses.worker(); if (worker != null) worker.offer((SessionChangeRequest)req); } if (msgQueueLsnr != null) msgQueueLsnr.apply(ses, msgCnt); }
/** * @param reqs Requests to notify about error. */ private void notifyOnNodeLeft(SessionWriteRequest[] reqs) { IOException e = new IOException("Failed to send message, node has left: " + node.id()); IgniteException cloErr = null; for (SessionWriteRequest req : reqs) { req.onError(e); if (req.ackClosure() != null) { if (cloErr == null) cloErr = new IgniteException(e); req.ackClosure().apply(cloErr); } } }
/** * @param ses Session. * @param req Request. * @param sys System message flag. * @throws IgniteCheckedException If session was closed. */ private void send0(GridSelectorNioSessionImpl ses, SessionWriteRequest req, boolean sys) throws IgniteCheckedException { assert ses != null; assert req != null; int msgCnt = sys ? ses.offerSystemFuture(req) : ses.offerFuture(req); if (ses.closed()) { if (ses.removeFuture(req)) { IOException err = new IOException("Failed to send message (connection was closed): " + ses); req.onError(err); if (!(req instanceof GridNioFuture)) throw new IgniteCheckedException(err); } } else if (!ses.procWrite.get() && ses.procWrite.compareAndSet(false, true)) { AbstractNioClientWorker worker = (AbstractNioClientWorker)ses.worker(); if (worker != null) worker.offer((SessionChangeRequest)req); } if (msgQueueLsnr != null) msgQueueLsnr.apply(ses, msgCnt); }