/** * @param keys Keys. * @param e Error. */ void addFailedKeys(Collection<KeyCacheObject> keys, Throwable e) { if (failedKeys == null) failedKeys = new ArrayList<>(keys.size()); failedKeys.addAll(keys); if (err == null) err = new IgniteCheckedException("Failed to update keys on primary node."); err.addSuppressed(e); }
/** * Adds key to collection of failed keys. * * @param key Key to add. * @param e Error cause. */ void addFailedKey(KeyCacheObject key, Throwable e) { if (failedKeys == null) failedKeys = new ArrayList<>(); failedKeys.add(key); if (err == null) err = new IgniteCheckedException("Failed to update keys."); err.addSuppressed(e); }
/** * Creates an IgniteCheckedException that is used as root cause of the exchange initialization failure. * This method aggregates all the exceptions provided from all participating nodes. * * @param globalExceptions collection exceptions from all participating nodes. * @return exception that represents a cause of the exchange initialization failure. */ private IgniteCheckedException createExchangeException(Map<UUID, Exception> globalExceptions) { IgniteCheckedException ex = new IgniteCheckedException("Failed to complete exchange process."); for (Map.Entry<UUID, Exception> entry : globalExceptions.entrySet()) if (ex != entry.getValue()) ex.addSuppressed(entry.getValue()); return ex; }
/** * Creates {@code IgniteCheckedException} with the collection of suppressed exceptions. * * @param msg Message. * @param suppressed The collections of suppressed exceptions. * @return {@code IgniteCheckedException}. */ public static IgniteCheckedException exceptionWithSuppressed(String msg, @Nullable Collection<Throwable> suppressed) { IgniteCheckedException e = new IgniteCheckedException(msg); if (suppressed != null) { for (Throwable th : suppressed) e.addSuppressed(th); } return e; }
/** * @param store Store to shutdown. * @param cleanFile {@code True} if files should be cleaned. * @param aggr Aggregating exception. * @return Aggregating exception, if error occurred. */ private IgniteCheckedException shutdown(PageStore store, boolean cleanFile, IgniteCheckedException aggr) { try { if (store != null) store.stop(cleanFile); } catch (IgniteCheckedException e) { if (aggr == null) aggr = new IgniteCheckedException("Failed to gracefully shutdown store"); aggr.addSuppressed(e); } return aggr; }
@Override public void apply(CacheSearchRow row) { try { rowStore.removeRow(row.link(), grp.statisticsHolderData()); } catch (IgniteCheckedException e) { U.error(log, "Failed to remove row [link=" + row.link() + "]"); IgniteCheckedException ex = exception.get(); if (ex == null) exception.set(e); else ex.addSuppressed(e); } } });
err = e; else err.addSuppressed(e);
/** * */ private void onAllReceived() { IgniteCheckedException e = new IgniteCheckedException(); boolean fail = false; for (Map.Entry<UUID, GridChangeGlobalStateMessageResponse> entry : responses.entrySet()) { GridChangeGlobalStateMessageResponse r = entry.getValue(); if (r.getError() != null) { fail = true; e.addSuppressed(r.getError()); } } if (fail) onDone(e); else onDone(); }
/** * @param nodeId Node ID. * @param errMsg Error message. */ synchronized void onOperationFailOnNode(UUID nodeId, String errMsg) { assert receivedFinish != null : "Process operation state on client"; if (log.isDebugEnabled()) log.debug("User operation is failed [nodeId=" + nodeId + ", err=" + errMsg + ']'); receivedFinish.add(nodeId); UserManagementException e = new UserManagementException("Operation failed [nodeId=" + nodeId + ", opId=" + opId + ", err=" + errMsg + ']'); if (err == null) err = e; else err.addSuppressed(e); checkOperationFinished(); }
/** * @return A multi exception with few nested causes and * {@link IllegalAccessException} in hierarchy. */ private IgniteCheckedException prepareMultiException() { IgniteCheckedException me = new IgniteCheckedException("Test message."); for (int i = 0; i < 3; i++) { try { generateException(3, new IllegalArgumentException()); } catch (IgniteCheckedException e) { me.addSuppressed(e); } } return me; }
/** * @param nodes Destination nodes. * @param topic Topic to send the message to. * @param msg Message to send. * @param plc Type of processing. * @throws IgniteCheckedException Thrown in case of any errors. */ public void sendToGridTopic( Collection<? extends ClusterNode> nodes, GridTopic topic, Message msg, byte plc ) throws IgniteCheckedException { assert F.find(nodes, null, F.localNode(locNodeId)) == null : "Internal Ignite code should never call the method with local node in a node list."; IgniteCheckedException err = null; for (ClusterNode node : nodes) { try { send(node, topic, topic.ordinal(), msg, plc, false, 0, false, null, false); } catch (IgniteCheckedException e) { if (err == null) err = e; else err.addSuppressed(e); } } if (err != null) throw err; }
error.addSuppressed(suppressedErr);
/** * @param ctx Cache context. * @throws IgniteCheckedException If failed. */ public void prepareMarshal(GridCacheContext ctx) throws IgniteCheckedException { key.prepareMarshal(ctx.cacheObjectContext()); if (err != null && errBytes == null) { try { errBytes = U.marshal(ctx.marshaller(), err); } catch (IgniteCheckedException e) { // Try send exception even if it's unable to marshal. IgniteCheckedException exc = new IgniteCheckedException(err.getMessage()); exc.setStackTrace(err.getStackTrace()); exc.addSuppressed(e); errBytes = U.marshal(ctx.marshaller(), exc); } } assert unprepareRes == null : "marshalResult() was not called for the result: " + this; if (res != null) res.prepareMarshal(ctx.cacheObjectContext()); }
/** {@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); } } }
e.addSuppressed(entry.getValue());
e.addSuppressed(e1); e.addSuppressed(e1);
err0.addSuppressed(e);