private void notifyExceptionToMessageHandler(Throwable ex, ExceptionPhase phase) { if (!(ex instanceof IllegalStateException && this.getIsClosingOrClosed())) { this.customCodeExecutor.execute(() -> {this.messageHandler.notifyException(ex, phase);}); } }