You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2018/11/19 13:19:29 UTC
[1/4] httpcomponents-core git commit: Refactored output control in
the async HTTP/1.1 protocol handlers
Repository: httpcomponents-core
Updated Branches:
refs/heads/olegk_experimental [created] 9f306716e
Refactored output control in the async HTTP/1.1 protocol handlers
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/96a09490
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/96a09490
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/96a09490
Branch: refs/heads/olegk_experimental
Commit: 96a094907e803dcfe6cf923a6fcdd4a921eca778
Parents: 93f6131
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Nov 19 10:28:51 2018 +0100
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Mon Nov 19 10:28:51 2018 +0100
----------------------------------------------------------------------
.../impl/nio/AbstractHttp1StreamDuplexer.java | 24 +++++++++-----------
1 file changed, 11 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/96a09490/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
index 1ee2333..5b549ba 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
@@ -374,20 +374,18 @@ abstract class AbstractHttp1StreamDuplexer<IncomingMessage extends HttpMessage,
outputLock.unlock();
}
if (connState.compareTo(ConnectionState.SHUTDOWN) < 0) {
- if (isOutputReady()) {
- produceOutput();
- } else {
- final int pendingOutputRequests = outputRequests.get();
- outputLock.lock();
- try {
- if (!outbuf.hasData() && outputRequests.compareAndSet(pendingOutputRequests, 0)) {
- ioSession.clearEvent(SelectionKey.OP_WRITE);
- } else {
- outputRequests.addAndGet(-pendingOutputRequests);
- }
- } finally {
- outputLock.unlock();
+ produceOutput();
+ final int pendingOutputRequests = outputRequests.get();
+ final boolean outputPending = isOutputReady();
+ outputLock.lock();
+ try {
+ if (!outputPending && !outbuf.hasData() && outputRequests.compareAndSet(pendingOutputRequests, 0)) {
+ ioSession.clearEvent(SelectionKey.OP_WRITE);
+ } else {
+ outputRequests.addAndGet(-pendingOutputRequests);
}
+ } finally {
+ outputLock.unlock();
}
outputLock.lock();
[4/4] httpcomponents-core git commit: Refactored output control in
the async HTTP/2 protocol handlers
Posted by ol...@apache.org.
Refactored output control in the async HTTP/2 protocol handlers
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/9f306716
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/9f306716
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/9f306716
Branch: refs/heads/olegk_experimental
Commit: 9f306716ee38a94e8849d602b74e07991ea4b437
Parents: 746def4
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Nov 19 14:13:33 2018 +0100
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Mon Nov 19 14:13:33 2018 +0100
----------------------------------------------------------------------
.../nio/AbstractHttp2StreamMultiplexer.java | 22 ++++++++------------
1 file changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/9f306716/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
index 87312ba..e0b37f0 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
@@ -483,20 +483,16 @@ abstract class AbstractHttp2StreamMultiplexer implements Identifiable, HttpConne
}
}
}
- if (!outputPending) {
- outputLock.lock();
- try {
- if (!outputBuffer.isEmpty() || !outputQueue.isEmpty()) {
- outputPending = true;
- }
- } finally {
- outputLock.unlock();
+ outputLock.lock();
+ try {
+ if (!outputPending && outputBuffer.isEmpty() && outputQueue.isEmpty()
+ && outputRequests.compareAndSet(pendingOutputRequests, 0)) {
+ ioSession.clearEvent(SelectionKey.OP_WRITE);
+ } else {
+ outputRequests.addAndGet(-pendingOutputRequests);
}
- }
- if (!outputPending && outputRequests.compareAndSet(pendingOutputRequests, 0)) {
- ioSession.clearEvent(SelectionKey.OP_WRITE);
- } else {
- outputRequests.addAndGet(-pendingOutputRequests);
+ } finally {
+ outputLock.unlock();
}
}
[3/4] httpcomponents-core git commit: Minor optimization
Posted by ol...@apache.org.
Minor optimization
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/746def49
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/746def49
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/746def49
Branch: refs/heads/olegk_experimental
Commit: 746def4965692193b149bc76bd2b091395957a09
Parents: 8104ce4
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Nov 19 14:12:42 2018 +0100
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Mon Nov 19 14:12:42 2018 +0100
----------------------------------------------------------------------
.../hc/core5/http/nio/entity/BasicAsyncEntityProducer.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/746def49/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityProducer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityProducer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityProducer.java
index 4cf0a08..03bbfac 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityProducer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/BasicAsyncEntityProducer.java
@@ -128,7 +128,9 @@ public class BasicAsyncEntityProducer implements AsyncEntityProducer {
@Override
public final void produce(final DataStreamChannel channel) throws IOException {
- channel.write(bytebuf);
+ if (bytebuf.hasRemaining()) {
+ channel.write(bytebuf);
+ }
if (!bytebuf.hasRemaining()) {
channel.endStream();
}
[2/4] httpcomponents-core git commit: Fixed incorrect thread
synchronization in an HTTP/1.1 integration test
Posted by ol...@apache.org.
Fixed incorrect thread synchronization in an HTTP/1.1 integration test
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/8104ce48
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/8104ce48
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/8104ce48
Branch: refs/heads/olegk_experimental
Commit: 8104ce48c2a8cd717f613d3350770daa57b9b890
Parents: 96a0949
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Mon Nov 19 14:12:22 2018 +0100
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Mon Nov 19 14:12:22 2018 +0100
----------------------------------------------------------------------
.../org/apache/hc/core5/testing/nio/Http1IntegrationTest.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/8104ce48/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java
index a97f558..3661a80 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java
@@ -821,7 +821,9 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
responseChannel.sendInformation(new BasicHttpResponse(HttpStatus.SC_CONTINUE), context);
}
final HttpResponse response = new BasicHttpResponse(200);
- responseChannel.sendResponse(response, entityProducer, context);
+ synchronized (entityProducer) {
+ responseChannel.sendResponse(response, entityProducer, context);
+ }
}
} catch (final Exception ignore) {
// ignore