void removeHealthCheck(final Node node, XnioIoThread ioThread) { assert Thread.holdsLock(this); final HealthCheckTask task = healthChecks.get(ioThread); if (task == null) { return; } task.nodes.remove(node); if (task.nodes.size() == 0) { healthChecks.remove(ioThread); task.cancelKey.remove(); } }
@Override public int writeFinal(ByteBuffer src) throws IOException { int ret = super.writeFinal(src); handleWriteTimeout(ret); if(!src.hasRemaining()) { if(handle != null) { handle.remove(); handle = null; } } return ret; }
@Override public int writeFinal(ByteBuffer src) throws IOException { handleIdleTimeout(); int w = sink.writeFinal(src); if(source.isReadShutdown() && !src.hasRemaining()) { if(handle != null) { handle.remove(); handle = null; } } return w; }
@Override public void suspendWrites() { super.suspendWrites(); XnioExecutor.Key handle = this.handle; if(handle != null) { handle.remove(); this.handle = null; } }
private void cleanup() { if(handle != null) { handle.remove(); handle = null; } }
@Override public void suspendReads() { source.suspendReads(); XnioExecutor.Key handle = this.handle; if(handle != null && !isWriteResumed()) { handle.remove(); this.handle = null; } }
@Override public long read(ByteBuffer[] dsts, int offset, int length) throws IOException { handleIdleTimeout(); long r = source.read(dsts, offset, length); if(sink.isWriteShutdown() && r == -1) { if(handle != null) { handle.remove(); handle = null; } } return r; }
@Override public long transferTo(long count, ByteBuffer throughBuffer, StreamSinkChannel target) throws IOException { handleIdleTimeout(); long w = source.transferTo(count, throughBuffer, target); if(sink.isWriteShutdown() && w == -1) { if(handle != null) { handle.remove(); handle = null; } } return w; }
void cancel() { if (state == State.WAITING) { state = State.CANCELLED; if (cancelKey != null) { cancelKey.remove(); } delegate.failed(); } }
@Override public void suspendReads() { super.suspendReads(); XnioExecutor.Key handle = this.handle; if(handle != null) { handle.remove(); this.handle = null; } }
@Override public void terminateWrites() throws IOException { sink.terminateWrites(); if(source.isReadShutdown()) { if(handle != null) { handle.remove(); handle = null; } } }
@Override public void terminateReads() throws IOException { source.terminateReads(); if(sink.isWriteShutdown()) { if(handle != null) { handle.remove(); handle = null; } } }
@Override public void terminateWrites() throws IOException { super.terminateWrites(); if(handle != null) { handle.remove(); handle = null; } }
@Override public void truncateWrites() throws IOException { sink.truncateWrites(); if(source.isReadShutdown()) { if(handle != null) { handle.remove(); handle = null; } } }
@Override public void handleEvent(StreamSinkChannel channel) { if(timerKey != null) { timerKey.remove(); } for (ChannelListener<ServerSentEventConnection> listener : closeTasks) { ChannelListeners.invokeChannelListener(ServerSentEventConnection.this, listener); } IoUtils.safeClose(ServerSentEventConnection.this); } });
void terminateHeartbeat() { final XnioExecutor.Key key = writeListener.heartKey; if (key != null) { key.remove(); } }
public void close() { if(handle != null) { handle.remove(); handle = null; } } }
void taskFailed() { if (state == State.WAITING) { state = State.DONE; if (cancelKey != null) { cancelKey.remove(); } delegate.failed(); } }
void setCancelKey(XnioExecutor.Key cancelKey) { if (state == State.WAITING) { this.cancelKey = cancelKey; } else { cancelKey.remove(); } }
@Override public long writeFinal(ByteBuffer[] srcs, int offset, int length) throws IOException { handleIdleTimeout(); long w = sink.writeFinal(srcs, offset, length); if(source.isReadShutdown() && !Buffers.hasRemaining(srcs, offset, length)) { if(handle != null) { handle.remove(); handle = null; } } return w; }