/** * Shortcut method that creates an instance of {@link GridClosureException}. * * @param e Exception to wrap. * @return Newly created instance of {@link GridClosureException}. */ public static GridClosureException wrap(Throwable e) { return new GridClosureException(e); }
/** * Unwraps the original {@link Throwable} instance. * * @return The original {@link Throwable} instance. */ public Throwable unwrap() { return getCause(); } }
/** * Unwraps closure exceptions. * * @param t Exception. * @return Unwrapped exception. */ public static Exception unwrap(Throwable t) { assert t != null; while (true) { if (t instanceof Error) throw (Error)t; if (t instanceof GridClosureException) { t = ((GridClosureException)t).unwrap(); continue; } return (Exception)t; } }
@Override public T apply(IgniteInternalFuture<IgniteInternalTx> f) { throw new GridClosureException(ex); } });
/** {@inheritDoc} */ @Override public <R> IgniteInternalFuture<R> chain(final IgniteClosure<? super IgniteInternalFuture<T>, R> doneCb) { try { return new GridFinishedFuture<>(doneCb.apply(this)); } catch (GridClosureException e) { return new GridFinishedFuture<>(e.unwrap()); } catch (RuntimeException | Error e) { return new GridFinishedFuture<>(e); } }
/** * Unwraps the original {@link Throwable} instance. * * @return The original {@link Throwable} instance. */ public Throwable unwrap() { return getCause(); } }
@Override public T apply(IgniteInternalFuture<IgniteInternalTx> f) { throw new GridClosureException(e); } });
@Override public void run() { try { fut.onDone(doneCb.apply(GridFinishedFuture.this)); } catch (GridClosureException e) { fut.onDone(e.unwrap()); } catch (RuntimeException | Error e) { fut.onDone(e); throw e; } } });
@Override public T apply(IgniteInternalFuture<V> fut) { assert IgniteFutureImpl.this.fut == fut; try { return doneCb.apply(IgniteFutureImpl.this); } catch (Exception e) { throw new GridClosureException(e); } } };
/** * @param t Target future. */ private void applyCallback(IgniteInternalFuture<T> t) { try { fut.onDone(doneCb.apply(t)); } catch (GridClosureException e) { fut.onDone(e.unwrap()); } catch (RuntimeException | Error e) { fut.onDone(e); throw e; } } }
@Override public IgniteInternalFuture<Map<KeyCacheObject, EntryGetResult>> apply(Boolean b, Exception e) { if (e != null) throw new GridClosureException(e); return cache().getDhtAllAsync( keys.keySet(), args, readThrough, subjId, taskName, expiryPlc, skipVals, recovery, txLbl, mvccSnapshot); } }
err = e.unwrap();
/** {@inheritDoc} */ @Override public final IgniteInternalFuture<T> apply(T t, Exception e) { boolean rollback = true; try { if (e != null) throw new GridClosureException(e); IgniteInternalFuture<T> fut = postMiss(t); rollback = false; return fut; } catch (IgniteCheckedException ex) { throw new GridClosureException(ex); } finally { if (rollback) setRollbackOnly(); } }
c.apply(null, e); onDone(e.unwrap());
@Override public Void apply(IgniteInternalFuture<Map<Object, Object>> f) { try { Map<Object, Object> map = f.get(); processLoaded(map, keys, needVer, c); return null; } catch (Exception e) { setRollbackOnly(); throw new GridClosureException(e); } } });
c1.apply(null, e); onDone(e.unwrap());
@Override public Void apply(IgniteInternalFuture<Map<Object, Object>> f) { try { Map<Object, Object> map = f.get(); processLoaded(map, keys, needVer, c); return null; } catch (Exception e) { setRollbackOnly(); throw new GridClosureException(e); } } });
return new GridFinishedFuture<>(e.unwrap());
@Override public Void apply(IgniteInternalFuture<Object> f) { try { Object val = f.get(); processLoaded(key, val, needVer, skipVals, c); return null; } catch (Exception e) { setRollbackOnly(); throw new GridClosureException(e); } } });
return new GridFinishedFuture<>(e.unwrap());