@Override public OutboundPipeline wakeup() { addTaskAndWakeup(this); return this; } }
@Override public long lastWriteTimeMillis() { return outboundPipeline.lastWriteTimeMillis(); }
@Override public void run() { outboundPipeline.publishMetrics(); } });
flushToSocket(); case CLEAN: unschedule(); break; case DIRTY: registerOp(OP_WRITE); break; case BLOCKED: unregisterOp(OP_WRITE); break; default:
unregisterOp(OP_WRITE); owner().addTask(this);
@Probe(name = "priorityWriteQueuePendingBytes", level = DEBUG) public long priorityBytesPending() { return bytesPending(priorityWriteQueue); }
private NioOutboundPipeline newOutboundPipeline(NioChannel channel) { int index = hashToIndex(nextOutputThreadIndex.getAndIncrement(), outputThreadCount); NioThread[] threads = outputThreads; if (threads == null) { throw new IllegalStateException("NioNetworking is shutdown!"); } return new NioOutboundPipeline( channel, threads[index], errorHandler, loggingService.getLogger(NioOutboundPipeline.class), ioBalancer); }
@Override public OutboundPipeline remove(OutboundHandler handler) { return replace(handler); }
@Override protected void close0() { outboundPipeline.drainWriteQueues(); // the socket is immediately closed. try { socketChannel.close(); } catch (IOException e) { if (logger.isFineEnabled()) { logger.fine("Failed to close " + this, e); } } if (Thread.currentThread() instanceof NioThread) { // we don't want to do any tasks on an io thread; we offload it instead try { closeListenerExecutor.execute(new NotifyCloseListenersTask()); } catch (RejectedExecutionException e) { // if the task gets rejected, the networking must be shutting down. logger.fine(e); } } else { notifyCloseListeners(); } }
@Override public void run() { for (NioChannel channel : channels) { final NioInboundPipeline inboundPipeline = channel.inboundPipeline; NioThread inputThread = inboundPipeline.owner(); if (inputThread != null) { inputThread.addTaskAndWakeup(new Runnable() { @Override public void run() { inboundPipeline.publishMetrics(); } }); } final NioOutboundPipeline outboundPipeline = channel.outboundPipeline; NioThread outputThread = outboundPipeline.owner(); if (outputThread != null) { outputThread.addTaskAndWakeup(new Runnable() { @Override public void run() { outboundPipeline.publishMetrics(); } }); } } } }
flushToSocket(); case CLEAN: unschedule(); break; case DIRTY: registerOp(OP_WRITE); break; case BLOCKED: unregisterOp(OP_WRITE); break; default:
unregisterOp(OP_WRITE); owner().addTask(this);
@Probe(name = "writeQueuePendingBytes", level = DEBUG) public long bytesPending() { return bytesPending(writeQueue); }
private NioOutboundPipeline newOutboundPipeline(NioChannel channel) { int index = hashToIndex(nextOutputThreadIndex.getAndIncrement(), outputThreadCount); NioThread[] threads = outputThreads; if (threads == null) { throw new IllegalStateException("NioNetworking is shutdown!"); } return new NioOutboundPipeline( channel, threads[index], errorHandler, loggingService.getLogger(NioOutboundPipeline.class), ioBalancer); }
@Override public OutboundPipeline remove(OutboundHandler handler) { return replace(handler); }
@Override protected void close0() { outboundPipeline.drainWriteQueues(); // the socket is immediately closed. try { socketChannel.close(); } catch (IOException e) { if (logger.isFineEnabled()) { logger.fine("Failed to close " + this, e); } } if (Thread.currentThread() instanceof NioThread) { // we don't want to do any tasks on an io thread; we offload it instead try { closeListenerExecutor.execute(new NotifyCloseListenersTask()); } catch (RejectedExecutionException e) { // if the task gets rejected, the networking must be shutting down. logger.fine(e); } } else { notifyCloseListeners(); } }
@Override public void run() { for (NioChannel channel : channels) { final NioInboundPipeline inboundPipeline = channel.inboundPipeline; NioThread inputThread = inboundPipeline.owner(); if (inputThread != null) { inputThread.addTaskAndWakeup(new Runnable() { @Override public void run() { inboundPipeline.publishMetrics(); } }); } final NioOutboundPipeline outboundPipeline = channel.outboundPipeline; NioThread outputThread = outboundPipeline.owner(); if (outputThread != null) { outputThread.addTaskAndWakeup(new Runnable() { @Override public void run() { outboundPipeline.publishMetrics(); } }); } } } }
@Override public OutboundPipeline wakeup() { addTaskAndWakeup(this); return this; } }
@Probe(name = "writeQueuePendingBytes", level = DEBUG) public long bytesPending() { return bytesPending(writeQueue); }
@Override public void run() { outboundPipeline.publishMetrics(); } });