@Override protected boolean isWritePossible() { this.channel.resumeWrites(); return this.writePossible; }
@Override protected void readingPaused() { this.channel.suspendReads(); }
protected boolean flushAction(final boolean shutDown) throws IOException { synchronized (writeLock) { return (doFlushBuffer()) && channel.flush(); } }
public void setup(StreamSourceChannel channel) { channel.suspendReads(); channel.getReadSetter().set(this); channel.resumeReads(); }
private static <I extends StreamSourceChannel, O extends StreamSinkChannel> void done(I source, O sink, ChannelListener<? super I> sourceListener, ChannelListener<? super O> sinkListener) { Channels.setReadListener(source, sourceListener); if (sourceListener == null) { source.suspendReads(); } else { source.wakeupReads(); } Channels.setWriteListener(sink, sinkListener); if (sinkListener == null) { sink.suspendWrites(); } else { sink.wakeupWrites(); } }
@Override protected void writingComplete() { this.channel.getWriteSetter().set(null); this.channel.resumeWrites(); }
@Override protected void flush() throws IOException { StreamSinkChannel channel = UndertowServerHttpResponse.this.responseChannel; if (channel != null) { if (rsWriteFlushLogger.isTraceEnabled()) { rsWriteFlushLogger.trace(getLogPrefix() + "flush"); } channel.flush(); } }
private int writeByteBuffer(ByteBuffer byteBuffer) throws IOException { int written; int totalWritten = 0; do { written = this.channel.write(byteBuffer); totalWritten += written; } while (byteBuffer.hasRemaining() && written > 0); return totalWritten; }
@Override protected void checkOnDataAvailable() { this.channel.resumeReads(); // We are allowed to try, it will return null if data is not available onDataAvailable(); }
public <T> T setOption(final Option<T> option, final T value) throws IllegalArgumentException, IOException { return nonNullOrFirst(readChannel.setOption(option, value), writeChannel.setOption(option, value)); } }
/** * Simple utility method to execute a blocking write shutdown on a writable channel. The method blocks until the * channel's output side is fully shut down. * * @param channel the writable channel * @throws IOException if an I/O exception occurs * * @since 2.0 */ public static void shutdownWritesBlocking(SuspendableWriteChannel channel) throws IOException { channel.shutdownWrites(); flushBlocking(channel); }
public <T> T getOption(final Option<T> option) throws IOException { return nonNullOrFirst(readChannel.getOption(option), writeChannel.getOption(option)); }
public boolean supportsOption(final Option<?> option) { return readChannel.supportsOption(option) || writeChannel.supportsOption(option); }
@Override public void close() throws IOException { channel.close(); } }
/** * Construct a new instance. * * @param source the stream source channel * @param sink the stream sink channel */ public AssembledStreamChannel(final StreamSourceChannel source, final StreamSinkChannel sink) { this(new AssembledChannel(source, sink), source, sink); }
@Override protected boolean isWritePossible() { StreamSinkChannel channel = UndertowServerHttpResponse.this.responseChannel; if (channel != null) { // We can always call flush, just ensure writes are on.. channel.resumeWrites(); return true; } return false; }
@Override protected void readingPaused() { this.channel.suspendReads(); }
@Override protected boolean isWritePossible() { this.channel.resumeWrites(); return this.writePossible; }
@Override protected boolean isWritePossible() { StreamSinkChannel channel = UndertowServerHttpResponse.this.responseChannel; if (channel != null) { // We can always call flush, just ensure writes are on.. channel.resumeWrites(); return true; } return false; }