@Override public boolean isShutdown() { XnioWorker worker = getWorker().getOptionalValue(); return worker == null || worker.isShutdown(); }
/** * Schedules a task for future execution. If the execution is rejected because the worker is shutting * down then it is logged at debug level and the exception is not re-thrown * @param thread The IO thread * @param task The task to execute * @param timeout The timeout * @param timeUnit The time unit */ public static XnioExecutor.Key executeAfter(XnioIoThread thread, Runnable task, long timeout, TimeUnit timeUnit) { try { return thread.executeAfter(task, timeout, timeUnit); } catch (RejectedExecutionException e) { if(thread.getWorker().isShutdown()) { UndertowLogger.ROOT_LOGGER.debugf(e, "Failed to schedule task %s as worker is shutting down", task); //we just return a bogus key in this case return new XnioExecutor.Key() { @Override public boolean remove() { return false; } }; } else { throw e; } } } }
@Override public boolean isShutdown() { return worker.isShutdown(); }
public boolean isRunning() { return !server.getWorker().isShutdown(); }
@Override public boolean isShuttingDown() { return executor.getWorker().isShutdown(); }
@Override public boolean isShutdown() { return executor.getWorker().isShutdown(); }
@Override public boolean isShutdown() { XnioWorker worker = getWorker().getOptionalValue(); return worker == null || worker.isShutdown(); }
@Override public boolean isShutdown() { XnioWorker worker = getWorker().getOptionalValue(); return worker == null || worker.isShutdown(); }
@Override public boolean isRunning() { return server != null && server.getWorker() != null && !server.getWorker().isTerminated() && !server.getWorker().isShutdown(); }
/** * Schedules a task for future execution. If the execution is rejected because the worker is shutting * down then it is logged at debug level and the exception is not re-thrown * @param thread The IO thread * @param task The task to execute * @param timeout The timeout * @param timeUnit The time unit */ public static XnioExecutor.Key executeAfter(XnioIoThread thread, Runnable task, long timeout, TimeUnit timeUnit) { try { return thread.executeAfter(task, timeout, timeUnit); } catch (RejectedExecutionException e) { if(thread.getWorker().isShutdown()) { UndertowLogger.ROOT_LOGGER.debugf(e, "Failed to schedule task %s as worker is shutting down", task); //we just return a bogus key in this case return new XnioExecutor.Key() { @Override public boolean remove() { return false; } }; } else { throw e; } } } }
/** * Schedules a task for future execution. If the execution is rejected because the worker is shutting * down then it is logged at debug level and the exception is not re-thrown * @param thread The IO thread * @param task The task to execute * @param timeout The timeout * @param timeUnit The time unit */ public static XnioExecutor.Key executeAfter(XnioIoThread thread, Runnable task, long timeout, TimeUnit timeUnit) { try { return thread.executeAfter(task, timeout, timeUnit); } catch (RejectedExecutionException e) { if(thread.getWorker().isShutdown()) { UndertowLogger.ROOT_LOGGER.debugf(e, "Failed to schedule task %s as worker is shutting down", task); //we just return a bogus key in this case return new XnioExecutor.Key() { @Override public boolean remove() { return false; } }; } else { throw e; } } } }
@Override protected void doStop() throws Exception { super.doStop(); if (endpoint.isWebSocket()) { endpoint.getComponent().unregisterEndpoint(endpoint.getHttpHandlerRegistrationInfo(), endpoint.getSslContext()); } if (worker != null && !worker.isShutdown()) { LOG.debug("Shutting down worker: {}", worker); worker.shutdown(); } }