/** * Converts exception, but unlike {@link #convertException(IgniteCheckedException)} * does not wrap passed in exception if none suitable converter found. * * @param e Ignite checked exception. * @return Ignite runtime exception. */ public static Exception convertExceptionNoWrap(IgniteCheckedException e) { C1<IgniteCheckedException, IgniteException> converter = exceptionConverters.get(e.getClass()); if (converter != null) return converter.apply(e); if (e.getCause() instanceof IgniteException) return (Exception)e.getCause(); return e; }
@Override public Boolean call() throws Exception { return ops.get(i0).get2().apply(futRes); } }).get(2, SECONDS));
/** * @param e Ignite checked exception. * @return Ignite runtime exception. */ public static IgniteException convertException(IgniteCheckedException e) { IgniteClientDisconnectedException e0 = e.getCause(IgniteClientDisconnectedException.class); if (e0 != null) { assert e0.reconnectFuture() != null : e0; throw e0; } IgniteClientDisconnectedCheckedException disconnectedErr = e.getCause(IgniteClientDisconnectedCheckedException.class); if (disconnectedErr != null) { assert disconnectedErr.reconnectFuture() != null : disconnectedErr; e = disconnectedErr; } C1<IgniteCheckedException, IgniteException> converter = exceptionConverters.get(e.getClass()); if (converter != null) return converter.apply(e); if (e.getCause() instanceof IgniteException) return (IgniteException)e.getCause(); return new IgniteException(e.getMessage(), e); }
/** * Concatenates elements using provided separator. * * @param elems Concatenated elements. * @param f closure used for transform element. * @param start Start string. * @param sep Separator. * @param end End string. * @return Concatenated string. */ protected static <T> String mkString(Iterable<T> elems, C1<T, String> f, String start, String sep, String end) { SB sb = new SB(start); boolean first = true; for (T elem : elems) { if (!first) sb.a(sep); sb.a(f.apply(elem)); first = false; } return sb.a(end).toString(); }
/** * @param e Ignite checked exception. * @return CacheException runtime exception, never null. */ public static @NotNull RuntimeException convertToCacheException(IgniteCheckedException e) { IgniteClientDisconnectedCheckedException disconnectedErr = e.getCause(IgniteClientDisconnectedCheckedException.class); if (disconnectedErr != null) { assert disconnectedErr.reconnectFuture() != null : disconnectedErr; e = disconnectedErr; } if (e.hasCause(CacheWriterException.class)) return new CacheWriterException(U.convertExceptionNoWrap(e)); if (e instanceof CachePartialUpdateCheckedException) return new CachePartialUpdateException((CachePartialUpdateCheckedException)e); else if (e.hasCause(ClusterTopologyServerNotFoundException.class)) return new CacheServerNotFoundException(e.getMessage(), e); else if (e instanceof SchemaOperationException) return new CacheException(e.getMessage(), e); CacheException ce = X.cause(e, CacheException.class); if (ce != null) return ce; if (e.getCause() instanceof NullPointerException) return (NullPointerException)e.getCause(); if (e.getCause() instanceof SecurityException) return (SecurityException)e.getCause(); C1<IgniteCheckedException, IgniteException> converter = U.getExceptionConverter(e.getClass()); return converter != null ? new CacheException(converter.apply(e)) : new CacheException(e); }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (useStrLog) { strLog = new GridStringLogger(false, cfg.getGridLogger()); cfg.setGridLogger(strLog); } cfg.setDeploymentMode(depMode); if (cacheEnabled) { CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName(cacheName); cacheCfg.setCacheMode(cacheMode); cacheCfg.setAffinity(aff); cacheCfg.setBackups(backups); cacheCfg.setAtomicityMode(TRANSACTIONAL); if (initCache != null) initCache.apply(cacheCfg); cfg.setCacheConfiguration(cacheCfg); } else cfg.setCacheConfiguration(); return cfg; }
/** * Converts exception, but unlike {@link #convertException(IgniteCheckedException)} * does not wrap passed in exception if none suitable converter found. * * @param e Ignite checked exception. * @return Ignite runtime exception. */ public static Exception convertExceptionNoWrap(IgniteCheckedException e) { C1<IgniteCheckedException, IgniteException> converter = exceptionConverters.get(e.getClass()); if (converter != null) return converter.apply(e); if (e.getCause() instanceof IgniteException) return (Exception)e.getCause(); return e; }
/** * @param e Ignite checked exception. * @return Ignite runtime exception. */ public static IgniteException convertException(IgniteCheckedException e) { IgniteClientDisconnectedException e0 = e.getCause(IgniteClientDisconnectedException.class); if (e0 != null) { assert e0.reconnectFuture() != null : e0; throw e0; } IgniteClientDisconnectedCheckedException disconnectedErr = e.getCause(IgniteClientDisconnectedCheckedException.class); if (disconnectedErr != null) { assert disconnectedErr.reconnectFuture() != null : disconnectedErr; e = disconnectedErr; } C1<IgniteCheckedException, IgniteException> converter = exceptionConverters.get(e.getClass()); if (converter != null) return converter.apply(e); if (e.getCause() instanceof IgniteException) return (IgniteException)e.getCause(); return new IgniteException(e.getMessage(), e); }
/** * Concatenates elements using provided separator. * * @param elems Concatenated elements. * @param f closure used for transform element. * @param start Start string. * @param sep Separator. * @param end End string. * @return Concatenated string. */ protected static <T> String mkString(Iterable<T> elems, C1<T, String> f, String start, String sep, String end) { SB sb = new SB(start); boolean first = true; for (T elem : elems) { if (!first) sb.a(sep); sb.a(f.apply(elem)); first = false; } return sb.a(end).toString(); }
/** * @param e Ignite checked exception. * @return CacheException runtime exception, never null. */ @NotNull public static RuntimeException convertToCacheException(IgniteCheckedException e) { IgniteClientDisconnectedCheckedException disconnectedErr = e.getCause(IgniteClientDisconnectedCheckedException.class); if (disconnectedErr != null) { assert disconnectedErr.reconnectFuture() != null : disconnectedErr; e = disconnectedErr; } if (e.hasCause(CacheWriterException.class)) return new CacheWriterException(U.convertExceptionNoWrap(e)); if (e instanceof CachePartialUpdateCheckedException) return new CachePartialUpdateException((CachePartialUpdateCheckedException)e); else if (e instanceof ClusterTopologyServerNotFoundException) return new CacheServerNotFoundException(e.getMessage(), e); else if (e instanceof SchemaOperationException) return new CacheException(e.getMessage(), e); CacheException ce = X.cause(e, CacheException.class); if (ce != null) return ce; if (e.getCause() instanceof NullPointerException) return (NullPointerException)e.getCause(); if (e.getCause() instanceof SecurityException) return (SecurityException)e.getCause(); C1<IgniteCheckedException, IgniteException> converter = U.getExceptionConverter(e.getClass()); return converter != null ? new CacheException(converter.apply(e)) : new CacheException(e); }