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:32 UTC
[4/4] httpcomponents-core git commit: Refactored output control in
the async HTTP/2 protocol handlers
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();
}
}