@Override @Nullable public Object call() throws Exception { try { ggfsCtx.send(nodeId, topic, msg, SYSTEM_POOL); } catch (GridException e) { completionFut.onError(nodeId, e); } return null; } });
@Override @Nullable public Object call() throws Exception { try { ggfsCtx.send(nodeId, topic, msg, SYSTEM_POOL); } catch (GridException e) { completionFut.onError(nodeId, e); } return null; } });
/** * @param nodeId Node ID to send message to. * @param msg Message to send. * @throws GridException If send failed. */ private void sendWithRetries(UUID nodeId, GridGgfsCommunicationMessage msg) throws GridException { for (int i = 0; i < MESSAGE_SEND_RETRY_COUNT; i++) { try { ggfsCtx.send(nodeId, topic, msg, SYSTEM_POOL); return; } catch (GridException e) { if (!ggfsCtx.kernalContext().discovery().alive(nodeId)) throw new GridTopologyException("Failed to send message (node left the grid) " + "[nodeId=" + nodeId + ", msg=" + msg + ']'); if (i == MESSAGE_SEND_RETRY_COUNT - 1) throw e; U.sleep(MESSAGE_SEND_RETRY_INTERVAL); } } }
/** * @param nodeId Node ID to send message to. * @param msg Message to send. * @throws GridException If send failed. */ private void sendWithRetries(UUID nodeId, GridGgfsCommunicationMessage msg) throws GridException { for (int i = 0; i < MESSAGE_SEND_RETRY_COUNT; i++) { try { ggfsCtx.send(nodeId, topic, msg, SYSTEM_POOL); return; } catch (GridException e) { if (!ggfsCtx.kernalContext().discovery().alive(nodeId)) throw new GridTopologyException("Failed to send message (node left the grid) " + "[nodeId=" + nodeId + ", msg=" + msg + ']'); if (i == MESSAGE_SEND_RETRY_COUNT - 1) throw e; U.sleep(MESSAGE_SEND_RETRY_INTERVAL); } } }
/** * Send delete message to all meta cache nodes in the grid. * * @param msg Message to send. */ private void sendDeleteMessage(GridGgfsDeleteMessage msg) { assert msg != null; Collection<GridNode> nodes = meta.metaCacheNodes(); boolean first = true; for (GridNode node : nodes) { GridGgfsCommunicationMessage msg0 = first ? msg : (GridGgfsCommunicationMessage)msg.clone(); first = false; try { ggfsCtx.send(node, topic, msg0, GridIoPolicy.SYSTEM_POOL); } catch (GridException e) { U.warn(log, "Failed to send GGFS delete message to node [nodeId=" + node.id() + ", msg=" + msg + ", err=" + e.getMessage() + ']'); } } } }
/** * Send delete message to all meta cache nodes in the grid. * * @param msg Message to send. */ private void sendDeleteMessage(GridGgfsDeleteMessage msg) { assert msg != null; Collection<GridNode> nodes = meta.metaCacheNodes(); boolean first = true; for (GridNode node : nodes) { GridGgfsCommunicationMessage msg0 = first ? msg : (GridGgfsCommunicationMessage)msg.clone(); first = false; try { ggfsCtx.send(node, topic, msg0, GridIoPolicy.SYSTEM_POOL); } catch (GridException e) { U.warn(log, "Failed to send GGFS delete message to node [nodeId=" + node.id() + ", msg=" + msg + ", err=" + e.getMessage() + ']'); } } } }
@Override public void apply(GridFuture<?> fut) { GridException err = null; try { fut.get(); } catch (GridException e) { err = e; } try { // Send reply back to node. ggfsCtx.send(nodeId, topic, new GridGgfsAckMessage(blocksMsg.fileId(), blocksMsg.id(), err), SYSTEM_POOL); } catch (GridException e) { U.warn(log, "Failed to send batch acknowledgement (did node leave the grid?) [nodeId=" + nodeId + ", fileId=" + blocksMsg.fileId() + ", batchId=" + blocksMsg.id() + ']', e); } } });
@Override public void apply(GridFuture<?> fut) { GridException err = null; try { fut.get(); } catch (GridException e) { err = e; } try { // Send reply back to node. ggfsCtx.send(nodeId, topic, new GridGgfsAckMessage(blocksMsg.fileId(), blocksMsg.id(), err), SYSTEM_POOL); } catch (GridException e) { U.warn(log, "Failed to send batch acknowledgement (did node leave the grid?) [nodeId=" + nodeId + ", fileId=" + blocksMsg.fileId() + ", batchId=" + blocksMsg.id() + ']', e); } } });