[grizzly~git:ef23ee05] [master] + optimize HttpClientFilter by removing responseQueue.contains(m

  • From: oleksiys@...
  • To: commits@...
  • Subject: [grizzly~git:ef23ee05] [master] + optimize HttpClientFilter by removing responseQueue.contains(m
  • Date: Tue, 17 Sep 2013 23:46:46 +0000

Project:    grizzly
Repository: git
Revision:   ef23ee05ef878ba78b61f2f7f59f55738424872d
Author:     oleksiys
Date:       2013-09-17 23:45:49 UTC
Link:       

Log Message:
------------
[master] + optimize HttpClientFilter by removing 
responseQueue.contains(message) check



Revisions:
----------
ef23ee05ef878ba78b61f2f7f59f55738424872d


Modified Paths:
---------------
modules/http/src/main/java/org/glassfish/grizzly/http/HttpClientFilter.java


Diffs:
------
--- 
a/modules/http/src/main/java/org/glassfish/grizzly/http/HttpClientFilter.java
+++ 
b/modules/http/src/main/java/org/glassfish/grizzly/http/HttpClientFilter.java
@@ -105,26 +105,22 @@ public class HttpClientFilter extends HttpCodecFilter {
     public NextAction handleWrite(FilterChainContext ctx) throws IOException 
{
 
         final Connection c = ctx.getConnection();
-        final Queue<HttpRequestPacket> requestQueue = getRequestQueue(c);
         final Object message = ctx.getMessage();
-        //noinspection SuspiciousMethodCalls
-        if (requestQueue.isEmpty() || !requestQueue.contains(message)) {
-            if (HttpHeader.isHttp(message)) {
-                HttpHeader header;
-                if (message instanceof HttpHeader) {
-                    header = (HttpHeader) message;
-                } else {
-                    header = ((HttpContent) message).getHttpHeader();
-                }
-                if (header.isRequest()) {
-                    requestQueue.offer((HttpRequestPacket) header);
-                }
+  
+        if (HttpPacket.isHttp(message)) {
+            assert message instanceof HttpPacket;
+            
+            final HttpHeader header = ((HttpPacket) message).getHttpHeader();
+            
+            if (!header.isCommitted() && header.isRequest()) {
+                assert header instanceof HttpRequestPacket;
+                getRequestQueue(c).offer((HttpRequestPacket) header);
             }
         }
-        return super.handleWrite(ctx);
 
+        return super.handleWrite(ctx);
     }
-
+    
     /**
      * The method is called, once we have received a {@link Buffer},
      * which has to be transformed into HTTP response packet part.





[grizzly~git:ef23ee05] [master] + optimize HttpClientFilter by removing responseQueue.contains(m

oleksiys 09/17/2013
Terms of Use; Privacy Policy; Copyright ©2013-2016 (revision 20160708.bf2ac18)
 
 
Close
loading
Please Confirm
Close