@Override protected ChannelIoSession<? extends ChannelConfig> createSession(Channel channel, IoProcessorEx<ChannelIoSession<? extends ChannelConfig>> processor) { return new NioSocketChannelIoSession(this, processor, (NioSocketChannel) channel); }
@Override protected void setIoAlignment0(Thread ioThread, Executor ioExecutor) { NioSocketChannel channel = (NioSocketChannel) getChannel(); if (ioExecutor == NO_EXECUTOR) { channel.setWorker(null); } else if (isClosedReceived()) { // Process the closed event now that realignment is complete // We must not register the channel with the worker since it is closed getProcessor().remove(this); } else { AbstractNioWorker newWorker = ((WorkerExecutor) ioExecutor).worker; channel.setWorker(newWorker); } }
private static Executor asExecutor(NioWorker worker) { WorkerExecutor executor = (WorkerExecutor) CURRENT_WORKER.get(); if (executor == null) { assert isInIoThread(worker) : "Session created from non-I/O thread"; executor = new WorkerExecutor(worker); CURRENT_WORKER.set(executor); } assert executor.worker == worker : "Worker does not match I/O thread"; return executor; }
public NioSocketChannelIoSession(ChannelIoService service, IoProcessorEx<ChannelIoSession<? extends ChannelConfig>> processor, NioSocketChannel channel) { super(service, processor, channel, new NioSocketChannelIoSessionConfig(channel.getConfig()), currentThread(), asExecutor(channel.getWorker())); }
@Override protected ChannelIoSession<? extends ChannelConfig> createSession(Channel channel, IoProcessorEx<ChannelIoSession<? extends ChannelConfig>> processor) { return new NioSocketChannelIoSession(this, processor, (NioSocketChannel) channel); }