/** * Construct a new instance. * * @param readThread the read thread for this conduit */ public EmptyStreamSourceConduit(final XnioIoThread readThread) { this.worker = readThread.getWorker(); this.readThread = readThread; }
/** * Construct a new instance. * * @param writeThread the write thread for this conduit */ public NullStreamSinkConduit(final XnioIoThread writeThread) { this.worker = writeThread.getWorker(); this.writeThread = writeThread; }
/** * Construct a new instance. * * @param readThread the read thread for this conduit */ public EmptyStreamSourceConduit(final XnioIoThread readThread) { this.worker = readThread.getWorker(); this.readThread = readThread; }
public XnioWorker getWorker() { return thread.getWorker(); }
public final XnioWorker getWorker() { return thread.getWorker(); }
public XnioWorker getWorker() { return thread.getWorker(); }
public NioXnioWorker getWorker() { return (NioXnioWorker) super.getWorker(); }
@Override public void failed() { if (healthCheckFailed() == threshold) { // Remove using the executor task pool ioThread.getWorker().execute(new Runnable() { @Override public void run() { container.removeNode(Node.this, true); clearActivePing(); } }); } else { clearActivePing(); } } }, healthChecker, ioThread, bufferPool, container.getClient(), container.getXnioSsl(), OptionMap.EMPTY);
public XnioWorker getWorker() { return connection.getIoThread().getWorker(); }
private IoFuture<StreamConnection> internalOpenTcpStreamConnection(InetSocketAddress destination, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap) { if (destination.isUnresolved()) { try { destination = new InetSocketAddress(InetAddress.getByName(destination.getHostString()), destination.getPort()); } catch (UnknownHostException e) { return new FailedIoFuture<>(e); } } InetSocketAddress bindAddress = getWorker().getBindAddressTable().get(destination.getAddress()); return openTcpStreamConnection(bindAddress, destination, openListener, bindListener, optionMap); }
/** * 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; } } } }
/** * Try to open a socket connection to given address. * * @param address the socket address * @param exchange the http servers exchange * @param callback the ping callback * @param options the options */ static void pingHost(InetSocketAddress address, HttpServerExchange exchange, PingCallback callback, OptionMap options) { final XnioIoThread thread = exchange.getIoThread(); final XnioWorker worker = thread.getWorker(); final HostPingTask r = new HostPingTask(address, worker, callback, options); // Schedule timeout task scheduleCancelTask(exchange.getIoThread(), r, 5, TimeUnit.SECONDS); exchange.dispatch(exchange.isInIoThread() ? SameThreadExecutor.INSTANCE : thread, r); }
/** * Construct a new instance. * * @param readThread the read thread for this conduit */ public EmptyStreamSourceConduit(final XnioIoThread readThread) { this.worker = readThread.getWorker(); this.readThread = readThread; }
/** * Construct a new instance. * * @param readThread the read thread for this conduit */ public EmptyStreamSourceConduit(final XnioIoThread readThread) { this.worker = readThread.getWorker(); this.readThread = readThread; }
/** * Construct a new instance. * * @param writeThread the write thread for this conduit */ public NullStreamSinkConduit(final XnioIoThread writeThread) { this.worker = writeThread.getWorker(); this.writeThread = writeThread; }
/** * Construct a new instance. * * @param readThread the read thread for this conduit */ public EmptyStreamSourceConduit(final XnioIoThread readThread) { this.worker = readThread.getWorker(); this.readThread = readThread; }
@Override public boolean isShuttingDown() { return executor.getWorker().isShutdown(); }
@Override public boolean isTerminated() { return executor.getWorker().isTerminated(); }
private IoFuture<StreamConnection> internalOpenTcpStreamConnection(InetSocketAddress destination, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap) { if (destination.isUnresolved()) { try { destination = new InetSocketAddress(InetAddress.getByName(destination.getHostString()), destination.getPort()); } catch (UnknownHostException e) { return new FailedIoFuture<>(e); } } InetSocketAddress bindAddress = getWorker().getBindAddressTable().get(destination.getAddress()); return openTcpStreamConnection(bindAddress, destination, openListener, bindListener, optionMap); }
@Override protected void doBind(SocketAddress localAddress) throws Exception { XnioWorker worker = ((XnioEventLoop) eventLoop()).ioThread().getWorker(); // use the same thread count as the XnioWorker OptionMap map = options.set(Options.WORKER_IO_THREADS, worker.getIoThreadCount()).getMap(); XnioEventLoop eventLoop = (XnioEventLoop) eventLoop(); synchronized (this) { channel = eventLoop.ioThread().getWorker().createStreamConnectionServer(localAddress, new AcceptListener(), map); // start accepting channel.resumeAccepts(); } }