public static RuntimeException peel(final Throwable t) { return (RuntimeException) peel(t, null, null, HAZELCAST_EXCEPTION_FACTORY); }
@Override protected Throwable adjustThrowable(Throwable t) { return peel(t); }
@Override protected Throwable adjustThrowable(Throwable t) { return peel(t); }
public static RuntimeException peel(final Throwable t) { return (RuntimeException) peel(t, null, null, HAZELCAST_EXCEPTION_FACTORY); }
/** * Processes {@code Throwable t} so that the returned {@code Throwable}'s type matches {@code allowedType} or * {@code RuntimeException}. Processing may include unwrapping {@code t}'s cause hierarchy, wrapping it in a * {@code HazelcastException} or just returning the same instance {@code t} if it is already an instance of * {@code RuntimeException}. * * @param t {@code Throwable} to be peeled * @param allowedType the type expected to be returned; when {@code null}, this method returns instances * of {@code RuntimeException} * @param message if not {@code null}, used as the message in the {@code HazelcastException} that * may wrap the peeled {@code Throwable} * @param <T> expected type of {@code Throwable} * @return the peeled {@code Throwable} */ public static <T extends Throwable> Throwable peel(final Throwable t, Class<T> allowedType, String message) { return peel(t, allowedType, message, HAZELCAST_EXCEPTION_FACTORY); }
/** * Processes {@code Throwable t} so that the returned {@code Throwable}'s type matches {@code allowedType} or * {@code RuntimeException}. Processing may include unwrapping {@code t}'s cause hierarchy, wrapping it in a * {@code HazelcastException} or just returning the same instance {@code t} if it is already an instance of * {@code RuntimeException}. * * @param t {@code Throwable} to be peeled * @param allowedType the type expected to be returned; when {@code null}, this method returns instances * of {@code RuntimeException} * @param message if not {@code null}, used as the message in the {@code HazelcastException} that * may wrap the peeled {@code Throwable} * @param <T> expected type of {@code Throwable} * @return the peeled {@code Throwable} */ public static <T extends Throwable> Throwable peel(final Throwable t, Class<T> allowedType, String message) { return peel(t, allowedType, message, HAZELCAST_EXCEPTION_FACTORY); }
private Throwable peelIfNeeded(Throwable t) { if (t == null) { return null; } for (Class<? extends Throwable> clazz : NON_PEELABLE_EXCEPTIONS) { if (clazz.isAssignableFrom(t.getClass())) { return t; } } return peel(t); } }
private Throwable peelIfNeeded(Throwable t) { if (t == null) { return null; } for (Class<? extends Throwable> clazz : NON_PEELABLE_EXCEPTIONS) { if (clazz.isAssignableFrom(t.getClass())) { return t; } } return peel(t); } }
@Override public void handleException(Throwable throwable) { boolean causedByInactiveInstance = peel(throwable) instanceof HazelcastInstanceNotActiveException; Level level = causedByInactiveInstance ? FINEST : WARNING; logger.log(level, "Error while destroying a proxy.", throwable); } };
public static <T extends Throwable> RuntimeException rethrow(final Throwable t, Class<T> allowedType) throws T { rethrowIfError(t); throw (T) peel(t, allowedType, null); }
@Override public void handleException(Throwable throwable) { boolean causedByInactiveInstance = peel(throwable) instanceof HazelcastInstanceNotActiveException; Level level = causedByInactiveInstance ? FINEST : WARNING; logger.log(level, "Error while destroying a proxy.", throwable); } };
/** * This rethrow the exception providing an allowed Exception in first priority, even it is a Runtime exception */ public static <T extends Throwable> RuntimeException rethrowAllowedTypeFirst(final Throwable t, Class<T> allowedType) throws T { rethrowIfError(t); if (allowedType.isAssignableFrom(t.getClass())) { throw (T) t; } else { throw peel(t); } }
public static RuntimeException rethrow(final Throwable t) { rethrowIfError(t); throw peel(t); }
public static RuntimeException rethrow(final Throwable t) { rethrowIfError(t); throw peel(t); }
/** * This rethrow the exception providing an allowed Exception in first priority, even it is a Runtime exception */ public static <T extends Throwable> RuntimeException rethrowAllowedTypeFirst(final Throwable t, Class<T> allowedType) throws T { rethrowIfError(t); if (allowedType.isAssignableFrom(t.getClass())) { throw (T) t; } else { throw peel(t); } }
public static RuntimeException rethrow(final Throwable t, RuntimeExceptionFactory runtimeExceptionFactory) { rethrowIfError(t); throw (RuntimeException) peel(t, null, null, runtimeExceptionFactory); }
public static RuntimeException rethrow(final Throwable t, RuntimeExceptionFactory runtimeExceptionFactory) { rethrowIfError(t); throw (RuntimeException) peel(t, null, null, runtimeExceptionFactory); }
public static <T extends Throwable> RuntimeException rethrow(final Throwable t, Class<T> allowedType) throws T { rethrowIfError(t); throw (T) peel(t, allowedType, null); }
private void unRegisterPartitionListenerIfExists() { if (this.partitionLostRegistration == null) { return; } try { getNodeEngine().getPartitionService().removePartitionLostListener(this.partitionLostRegistration); } catch (Exception ex) { if (peel(ex, HazelcastInstanceNotActiveException.class, null) instanceof HazelcastInstanceNotActiveException) { throw rethrow(ex); } } this.partitionLostRegistration = null; }
private void unRegisterPartitionListenerIfExists() { if (this.partitionLostRegistration == null) { return; } try { getNodeEngine().getPartitionService().removePartitionLostListener(this.partitionLostRegistration); } catch (Exception ex) { if (peel(ex, HazelcastInstanceNotActiveException.class, null) instanceof HazelcastInstanceNotActiveException) { throw rethrow(ex); } } this.partitionLostRegistration = null; }