@Override public void terminateWrites() throws IOException { if (anyAreSet(state, FLAG_WRITES_TERMINATED)) { return; } queueCloseFrames(); state |= FLAG_WRITES_TERMINATED; if (queuedData == 0) { state |= FLAG_DELEGATE_SHUTDOWN; doTerminateWrites(); finished(); } }
protected boolean flushQueuedData() throws IOException { if (queuedData > 0) { doWrite(null, 0, 0); } if (queuedData > 0) { return false; } if (anyAreSet(state, FLAG_WRITES_TERMINATED) && allAreClear(state, FLAG_DELEGATE_SHUTDOWN)) { doTerminateWrites(); state |= FLAG_DELEGATE_SHUTDOWN; finished(); } return next.flush(); }
@Override public boolean isWriteShutdown() { return super.isWriteShutdown() || anyAreSet(state, FLAG_WRITE_SHUTDOWN); }
@Override public int write(ByteBuffer src) throws IOException { if (anyAreSet(state, FLAG_WRITES_TERMINATED)) { throw UndertowMessages.MESSAGES.channelIsClosed(); } return (int) doWrite(new ByteBuffer[]{src}, 0, 1); }
boolean doGetRequestBodyChunk(ByteBuffer buffer, final AjpServerRequestConduit requestChannel) throws IOException { //first attempt to just write out the buffer //if there are other frames queued they will be written out first if(isWriteShutdown()) { throw UndertowMessages.MESSAGES.channelIsClosed(); } super.write(buffer); if (buffer.hasRemaining()) { //write it out in a listener this.state |= FLAG_WRITE_READ_BODY_CHUNK_FROM_LISTENER; queueFrame(new FrameCallBack() { @Override public void done() { state &= ~FLAG_WRITE_READ_BODY_CHUNK_FROM_LISTENER; if (allAreClear(state, FLAG_WRITE_RESUMED)) { next.suspendWrites(); } } @Override public void failed(IOException e) { requestChannel.setReadBodyChunkError(e); } }, buffer); next.resumeWrites(); return false; } return true; }
@Override public long write(ByteBuffer[] srcs, int offs, int len) throws IOException { if (anyAreSet(state, FLAG_WRITES_TERMINATED)) { throw UndertowMessages.MESSAGES.channelIsClosed(); } return doWrite(srcs, offs, len); }
long r = 0; do { r = super.write(buffers, 0, buffers.length); toWrite -= r; if (r == -1) {
@Override public void terminateWrites() throws IOException { if (anyAreSet(state, FLAG_WRITES_TERMINATED)) { return; } queueCloseFrames(); state |= FLAG_WRITES_TERMINATED; if (queuedData == 0) { state |= FLAG_DELEGATE_SHUTDOWN; doTerminateWrites(); finished(); } }
protected boolean flushQueuedData() throws IOException { if (queuedData > 0) { doWrite(null, 0, 0); } if (queuedData > 0) { return false; } if (anyAreSet(state, FLAG_WRITES_TERMINATED) && allAreClear(state, FLAG_DELEGATE_SHUTDOWN)) { doTerminateWrites(); state |= FLAG_DELEGATE_SHUTDOWN; finished(); } return next.flush(); }
@Override public int write(ByteBuffer src) throws IOException { if (anyAreSet(state, FLAG_WRITES_TERMINATED)) { throw UndertowMessages.MESSAGES.channelIsClosed(); } return (int) doWrite(new ByteBuffer[]{src}, 0, 1); }
boolean doGetRequestBodyChunk(ByteBuffer buffer, final AjpServerRequestConduit requestChannel) throws IOException { //first attempt to just write out the buffer //if there are other frames queued they will be written out first if(isWriteShutdown()) { throw UndertowMessages.MESSAGES.channelIsClosed(); } super.write(buffer); if (buffer.hasRemaining()) { //write it out in a listener this.state |= FLAG_WRITE_READ_BODY_CHUNK_FROM_LISTENER; queueFrame(new FrameCallBack() { @Override public void done() { state &= ~FLAG_WRITE_READ_BODY_CHUNK_FROM_LISTENER; if (allAreClear(state, FLAG_WRITE_RESUMED)) { next.suspendWrites(); } } @Override public void failed(IOException e) { requestChannel.setReadBodyChunkError(e); } }, buffer); next.resumeWrites(); return false; } return true; }
@Override public boolean isWriteShutdown() { return super.isWriteShutdown() || anyAreSet(state, FLAG_WRITE_SHUTDOWN); }
@Override public void terminateWrites() throws IOException { if (anyAreSet(state, FLAG_WRITES_TERMINATED)) { return; } queueCloseFrames(); state |= FLAG_WRITES_TERMINATED; if (queuedData == 0) { state |= FLAG_DELEGATE_SHUTDOWN; doTerminateWrites(); finished(); } }
protected boolean flushQueuedData() throws IOException { if (queuedData > 0) { doWrite(null, 0, 0); } if (queuedData > 0) { return false; } if (anyAreSet(state, FLAG_WRITES_TERMINATED) && allAreClear(state, FLAG_DELEGATE_SHUTDOWN)) { doTerminateWrites(); state |= FLAG_DELEGATE_SHUTDOWN; finished(); } return next.flush(); }
@Override public int write(ByteBuffer src) throws IOException { if (anyAreSet(state, FLAG_WRITES_TERMINATED)) { throw UndertowMessages.MESSAGES.channelIsClosed(); } return (int) doWrite(new ByteBuffer[]{src}, 0, 1); }
boolean doGetRequestBodyChunk(ByteBuffer buffer, final AjpServerRequestConduit requestChannel) throws IOException { //first attempt to just write out the buffer //if there are other frames queued they will be written out first if(isWriteShutdown()) { throw UndertowMessages.MESSAGES.channelIsClosed(); } super.write(buffer); if (buffer.hasRemaining()) { //write it out in a listener this.state |= FLAG_WRITE_READ_BODY_CHUNK_FROM_LISTENER; queueFrame(new FrameCallBack() { @Override public void done() { state &= ~FLAG_WRITE_READ_BODY_CHUNK_FROM_LISTENER; if (allAreClear(state, FLAG_WRITE_RESUMED)) { next.suspendWrites(); } } @Override public void failed(IOException e) { requestChannel.setReadBodyChunkError(e); } }, buffer); next.resumeWrites(); return false; } return true; }
@Override public boolean isWriteShutdown() { return super.isWriteShutdown() || anyAreSet(state, FLAG_WRITE_SHUTDOWN); }
@Override public long write(ByteBuffer[] srcs, int offs, int len) throws IOException { if (anyAreSet(state, FLAG_WRITES_TERMINATED)) { throw UndertowMessages.MESSAGES.channelIsClosed(); } return doWrite(srcs, offs, len); }
long r = 0; do { r = super.write(buffers, 0, buffers.length); toWrite -= r; if (r == -1) {
@Override public long write(ByteBuffer[] srcs, int offs, int len) throws IOException { if (anyAreSet(state, FLAG_WRITES_TERMINATED)) { throw UndertowMessages.MESSAGES.channelIsClosed(); } return doWrite(srcs, offs, len); }