/** * Returns whether the verbose exception mode is enabled. When enabled, the exceptions frequently thrown by * Armeria will have full stack trace. When disabled, such exceptions will have empty stack trace to * eliminate the cost of capturing the stack trace. * * @deprecated Use {@link Flags#verboseExceptions()} instead. */ @Deprecated public static boolean isVerbose() { return Flags.verboseExceptions(); }
/** * Returns a {@link ClosedSessionException} which may be a singleton or a new instance, depending on * whether {@linkplain Flags#verboseExceptions() the verbose exception mode} is enabled. */ public static ClosedSessionException get() { return Flags.verboseExceptions() ? new ClosedSessionException() : INSTANCE; }
/** * Returns a {@link ContentTooLargeException} which may be a singleton or a new instance, depending on * whether {@linkplain Flags#verboseExceptions() the verbose exception mode} is enabled. */ public static ContentTooLargeException get() { return Flags.verboseExceptions() ? new ContentTooLargeException() : INSTANCE; }
@Override public Throwable fillInStackTrace() { if (Flags.verboseExceptions()) { return super.fillInStackTrace(); } return this; } }
/** * Returns a {@link AbortedStreamException} which may be a singleton or a new instance, depending on * whether {@linkplain Flags#verboseExceptions() the verbose exception mode} is enabled. */ public static AbortedStreamException get() { return Flags.verboseExceptions() ? new AbortedStreamException() : INSTANCE; }
@Override public Throwable fillInStackTrace() { if (Flags.verboseExceptions()) { return super.fillInStackTrace(); } return this; } }
/** * Returns a {@link ClosedPublisherException} which may be a singleton or a new instance, depending on * whether {@linkplain Flags#verboseExceptions() the verbose exception mode} is enabled. */ public static ClosedPublisherException get() { return Flags.verboseExceptions() ? new ClosedPublisherException() : INSTANCE; }
@Override public Throwable fillInStackTrace() { if (Flags.verboseExceptions()) { super.fillInStackTrace(); } return this; } }
/** * Returns an {@link UnprocessedRequestException} which may be a singleton or a new instance, depending on * whether {@linkplain Flags#verboseExceptions() the verbose exception mode} is enabled. */ public static UnprocessedRequestException get() { return Flags.verboseExceptions() ? new UnprocessedRequestException() : INSTANCE; }
/** * Returns a {@link CancelledSubscriptionException} which may be a singleton or a new instance, depending * on whether {@linkplain Flags#verboseExceptions() the verbose exception mode} is enabled. */ public static CancelledSubscriptionException get() { return Flags.verboseExceptions() ? new CancelledSubscriptionException() : INSTANCE; }
if (Flags.verboseExceptions()) { return false;
/** * Returns a new {@link HttpStatusException} instance with the specified HTTP status code. */ public static HttpStatusException of(int statusCode) { if (statusCode < 0 || statusCode >= 1000) { final HttpStatus status = HttpStatus.valueOf(statusCode); if (Flags.verboseExceptions()) { return new HttpStatusException(status); } else { return new HttpStatusException(status, false); } } else { return EXCEPTIONS[statusCode]; } }
private void cancelOrAbort(boolean cancel) { final CloseEvent closeEvent; if (cancel) { closeEvent = Flags.verboseExceptions() ? new CloseEvent(CancelledSubscriptionException.get()) : CANCELLED_CLOSE; } else { closeEvent = Flags.verboseExceptions() ? new CloseEvent(AbortedStreamException.get()) : ABORTED_CLOSE; } if (closeEventUpdater.compareAndSet(this, null, closeEvent)) { if (subscription.needsDirectInvocation()) { cleanup(subscription); } else { subscription.executor().execute(() -> cleanup(subscription)); } } } }
private void doCancelOrAbort(boolean cancel) { if (state == State.OPEN) { doSetState(State.CLEANUP); final CloseEvent closeEvent; if (cancel) { closeEvent = Flags.verboseExceptions() ? new CloseEvent(CancelledSubscriptionException.get()) : CANCELLED_CLOSE; } else { closeEvent = Flags.verboseExceptions() ? new CloseEvent(AbortedStreamException.get()) : ABORTED_CLOSE; } doAddObjectOrEvent(closeEvent); return; } switch (state) { case CLOSED: // close() has been called before cancel(). There's no need to push a CloseEvent, // but we need to ensure the closeFuture is notified and any pending objects are removed. doSetState(State.CLEANUP); cleanup(); break; case CLEANUP: // Cleaned up already. break; default: // OPEN: should never reach here. throw new Error(); } }
final CloseEvent closeEvent; if (cancel) { closeEvent = Flags.verboseExceptions() ? new CloseEvent(CancelledSubscriptionException.get()) : CANCELLED_CLOSE; } else { closeEvent = Flags.verboseExceptions() ? new CloseEvent(AbortedStreamException.get()) : ABORTED_CLOSE;
@Test public void normal() { if (!Flags.verboseExceptions()) {
@Override public Throwable fillInStackTrace() { if (Flags.verboseExceptions()) { return super.fillInStackTrace(); } return this; } }