Skip to content

Commit

Permalink
Merge pull request #40 from fl4via/WEJBHTTP-45_master
Browse files Browse the repository at this point in the history
[WEJBHTTP-45] At WildflyClientOutputStream, do not flip the pooled bu…
  • Loading branch information
fl4via committed Jul 8, 2020
2 parents 352e063 + 24fa314 commit ed099e2
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -66,6 +66,9 @@ public void handleEvent(StreamSinkChannel streamSinkChannel) {
}
try {
boolean closed = anyAreSet(state, FLAG_CLOSED);
if (pooledBuffer != null) {
pooledBuffer.getBuffer().flip();
}
if (closed && (pooledBuffer == null || !pooledBuffer.getBuffer().hasRemaining())) {
if (pooledBuffer != null) {
pooledBuffer.close();
Expand All @@ -76,6 +79,7 @@ public void handleEvent(StreamSinkChannel streamSinkChannel) {
state |= FLAG_DONE;
state &= ~FLAG_WRITING;
lock.notifyAll();
streamSinkChannel.shutdownWrites();
}
} else {
while (pooledBuffer.getBuffer().hasRemaining()) {
Expand Down Expand Up @@ -182,9 +186,6 @@ public void write(final byte[] b, final int off, final int len) throws IOExcepti

private void runWriteTask() {
Assert.assertHoldsLock(lock);
if (pooledBuffer != null) {
pooledBuffer.getBuffer().flip();
}
state |= FLAG_WRITING;
channel.getWriteSetter().set(channelListener);
channel.wakeupWrites();
Expand Down

0 comments on commit ed099e2

Please sign in to comment.