@Override protected ChannelIoSession<? extends ChannelConfig> createSession(Channel channel, IoProcessorEx<ChannelIoSession<? extends ChannelConfig>> processor) { return new NioDatagramChannelIoSession(this, processor, (NioChildDatagramChannel) channel); }
@Override protected void setIoAlignment0(Thread ioThread, Executor ioExecutor) { NioChildDatagramChannel channel = (NioChildDatagramChannel) getChannel(); // TODO it may be NioDatagramChannel 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); } }
NioDatagramChannelIoSession(ChannelIoService service, IoProcessorEx<ChannelIoSession<? extends ChannelConfig>> processor, NioDatagramChannel channel) { super(service, processor, channel, new DefaultDatagramChannelIoSessionConfig(), currentThread(), asExecutor(channel.getWorker())); getFilterChain().addLast("udp#idle", IDLE_FILTER); }
private static Executor asExecutor(AbstractNioWorker 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; }
NioDatagramChannelIoSession(ChannelIoService service, IoProcessorEx<ChannelIoSession<? extends ChannelConfig>> processor, NioChildDatagramChannel channel) { super(service, processor, channel, new DefaultDatagramChannelIoSessionConfig(), currentThread(), asExecutor(channel.getWorker())); getFilterChain().addLast("udp#idle", IDLE_FILTER); }
@Override protected ChannelIoSession<? extends ChannelConfig> createSession(Channel channel, IoProcessorEx<ChannelIoSession<? extends ChannelConfig>> processor) { return new NioDatagramChannelIoSession(this, processor, (NioDatagramChannel) channel); }