/** * @param e Exception to handle. * @return GridSpiException Converted exception. */ private GridSpiException unwrapException(GridException e) { // Avoid double-wrapping. if (e.getCause() instanceof GridSpiException) return (GridSpiException)e.getCause(); return new GridSpiException("Failed to execute SPI context method.", e); } });
U.error(log, "Failed to get task result: " + fut, e); if (e.getCause() instanceof InterruptedException) throw new InterruptedException("Got interrupted while waiting for task completion.");
/** * @param filter Entry filter. * @return {@code True} if entry is visitable. */ public boolean visitable(GridPredicate<GridCacheEntry<K, V>>[] filter) { try { if (obsoleteOrDeleted() || (filter != CU.<K, V>empty() && !cctx.isAll(wrap(false), filter))) return false; } catch (GridException e) { U.error(log, "An exception was thrown while filter checking.", e); RuntimeException ex = e.getCause(RuntimeException.class); if (ex != null) throw ex; Error err = e.getCause(Error.class); if (err != null) throw err; return false; } GridCacheTxEx<K, V> tx = cctx.tm().localTxx(); return tx == null || !tx.removed(key); }
if (e.getCause() instanceof InterruptedException) isInterrupted = true; else
/** * Companion to {@link #callLocal(Callable, boolean)} but in case of rejected execution re-runs * the closure in the current thread (blocking). * * @param c Closure to execute. * @param plc Policy to choose executor pool. * @return Future. */ public <R> GridFuture<R> callLocalSafe(Callable<R> c, GridClosurePolicy plc) { try { return callLocal(c, plc); } catch (GridException e) { // If execution was rejected - rerun locally. if (e.getCause() instanceof RejectedExecutionException) { U.warn(log, "Closure execution has been rejected (will execute in the same thread) [plc=" + plc + ", closure=" + c + ']'); try { return new GridFinishedFuture<>(ctx, c.call()); } // If failed again locally - return error future. catch (Exception e2) { return new GridFinishedFuture<>(ctx, U.cast(e2)); } } // If failed for other reasons - return error future. else return new GridFinishedFuture<>(ctx, U.cast(e)); } }
/** {@inheritDoc} */ @Override public boolean sendMessage(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg) throws GridException { // Node ID is never provided in asynchronous send mode. assert nodeId == null; GridNioFuture<?> fut = ses.send(msg); if (fut.isDone()) { try { fut.get(); } catch (IOException e) { if (log.isDebugEnabled()) log.debug("Failed to send message [client=" + this + ", err=" +e + ']'); return true; } catch (GridException e) { if (log.isDebugEnabled()) log.debug("Failed to send message [client=" + this + ", err=" +e + ']'); if (e.getCause() instanceof IOException) return true; else throw new GridException("Failed to send message [client=" + this + ']', e); } } return false; }
if (e.getCause() instanceof InterruptedException) {
throw new GridInternalException(e.getCause(SQLException.class).getMessage(), e);
if (e.hasCause(SQLException.class)) U.error(log, "Failed to run fields query [node=" + cctx.nodeId() + ", msg=" + e.getCause(SQLException.class).getMessage() + ']'); else U.error(log, "Failed to run fields query [node=" + cctx.nodeId() +