@Override public void execute(Runnable command) { queue.put(command); }
@Override public int size() { return queue.size(); }
buffer = queue.swap(buffer); executor.execute(buffer); buffer.clear(); queue.setRunning(false); for (NioState nioState : handlers.values()) { nioState.onSelectorEnd();
public NioFiberImpl(final NioBatchExecutor executor, Collection<NioChannelHandler> nioHandlers, String threadName, boolean isDaemonThread, WriteFailure writeFailed, OnBuffer onBuffer) { this.executor = executor; this.writeFailed = writeFailed; this.onBuffer = onBuffer; this.scheduler = new SchedulerImpl(this); try { this.selector = Selector.open(); } catch (IOException e) { throw new RuntimeException(e); } for (NioChannelHandler nioHandler : nioHandlers) { synchronousAdd(nioHandler); } queue = new QueueSwapper(selector); thread = new Thread(this, threadName); thread.setDaemon(isDaemonThread); }
buffer = queue.swap(buffer); executor.execute(buffer); buffer.clear(); queue.setRunning(false); for (NioState nioState : handlers.values()) { nioState.onSelectorEnd();
public NioFiberImpl(final NioBatchExecutor executor, Collection<NioChannelHandler> nioHandlers, String threadName, boolean isDaemonThread, WriteFailure writeFailed, OnBuffer onBuffer) { this.executor = executor; this.writeFailed = writeFailed; this.onBuffer = onBuffer; this.scheduler = new SchedulerImpl(this); try { this.selector = Selector.open(); } catch (IOException e) { throw new RuntimeException(e); } for (NioChannelHandler nioHandler : nioHandlers) { synchronousAdd(nioHandler); } queue = new QueueSwapper(selector); thread = new Thread(this, threadName); thread.setDaemon(isDaemonThread); }
@Override public void execute(Runnable command) { queue.put(command); }
@Override public int size() { return queue.size(); }