cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r786160 - in /cxf/branches/2.1.x-fixes: ./ rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/ rt/transports/http-jetty/src/te...
Date Thu, 18 Jun 2009 16:58:12 GMT
Author: dkulp
Date: Thu Jun 18 16:58:12 2009
New Revision: 786160

URL: http://svn.apache.org/viewvc?rev=786160&view=rev
Log:
Merged revisions 786158 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes

................
  r786158 | dkulp | 2009-06-18 12:51:36 -0400 (Thu, 18 Jun 2009) | 9 lines
  
  Merged revisions 786142 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r786142 | dkulp | 2009-06-18 12:05:41 -0400 (Thu, 18 Jun 2009) | 1 line
    
    [CXF-2302] Fixes to the HTTP continuations to work with keep-alives
  ........
................

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java
    cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jun 18 16:58:12 2009
@@ -1,2 +1,2 @@
-/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656
-/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468
+/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158
+/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=786160&r1=786159&r2=786160&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
Thu Jun 18 16:58:12 2009
@@ -44,6 +44,7 @@
 import org.apache.cxf.transport.http.AbstractHTTPDestination;
 import org.apache.cxf.transport.http.HTTPSession;
 import org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider;
+import org.apache.cxf.transport.http_jetty.continuations.JettyContinuationWrapper;
 import org.apache.cxf.transports.http.QueryHandler;
 import org.apache.cxf.transports.http.QueryHandlerRegistry;
 import org.apache.cxf.transports.http.StemMatchingQueryHandler;
@@ -280,7 +281,6 @@
         }
         MessageImpl inMessage = retrieveFromContinuation(req);
         
-        
         if (inMessage == null) {
             
             inMessage = new MessageImpl();
@@ -302,6 +302,15 @@
             incomingObserver.onMessage(inMessage);
             resp.flushBuffer();
             baseRequest.setHandled(true);
+            JettyContinuationProvider p = (JettyContinuationProvider)inMessage
+                .get(ContinuationProvider.class.getName());
+            if (p != null) {
+                //make sure the continuation is stripped down 
+                JettyContinuationWrapper c = p.getContinuation(false);
+                if (c != null) {
+                    c.done();
+                }
+            }
         } catch (SuspendedInvocationException ex) {
             throw ex.getRuntimeException();
         } catch (RuntimeException ex) {
@@ -333,7 +342,7 @@
                 // if any, need to be restored
                 cont.setObject(ci.getUserObject());
             }
-            if (m == null && !cont.isNew()) {
+            if (m == null && (cont.isPending() || cont.isResumed())) {
                 String message = "No message for existing continuation, status : "
                     + (cont.isPending() ? "Pending" : "Resumed");
                 if (!(o instanceof ContinuationInfo)) {
@@ -342,7 +351,6 @@
                 LOG.warning(message);
             }
         }
-        
         return m;
     }
     

Modified: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java?rev=786160&r1=786159&r2=786160&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationProvider.java
Thu Jun 18 16:58:12 2009
@@ -29,17 +29,23 @@
 
     private HttpServletRequest request;
     private Message inMessage; 
+    private JettyContinuationWrapper wrapper;
     
     public JettyContinuationProvider(HttpServletRequest req, Message m) {
         request = req;
         this.inMessage = m;
     }
-    
     public Continuation getContinuation() {
+        return getContinuation(true);
+    }    
+    public JettyContinuationWrapper getContinuation(boolean create) {
         if (inMessage.getExchange().isOneWay()) {
             return null;
         }
-        return new JettyContinuationWrapper(request, inMessage);
+        if (wrapper == null && create) {
+            wrapper = new JettyContinuationWrapper(request, inMessage);
+        }
+        return wrapper;
     }
 
 }

Modified: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java?rev=786160&r1=786159&r2=786160&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapper.java
Thu Jun 18 16:58:12 2009
@@ -40,11 +40,15 @@
     }
 
     public Object getObject() {
-        return continuation.getObject();
+        Object o = continuation.getObject();
+        if (o instanceof ContinuationInfo) {
+            return ((ContinuationInfo)o).getUserObject();
+        }
+        return o;
     }
 
     public boolean isNew() {
-        return continuation.isNew();
+        return continuation.isNew() || (!continuation.isPending() && !continuation.isResumed());
     }
 
     public boolean isPending() {
@@ -92,12 +96,22 @@
             throw new SuspendedInvocationException(ex);
         }
     }
+    
+    public void done() {
+        ContinuationInfo ci = null;
+        Object obj = continuation.getObject();
+        if (obj instanceof ContinuationInfo) {
+            ci = (ContinuationInfo)obj;
+            continuation.setObject(ci.getUserObject());
+        }
+        continuation.reset();
+    }
 
     protected Message getMessage() {
         return message;
     }
     
-    protected org.mortbay.util.ajax.Continuation getContinuation() {
+    public org.mortbay.util.ajax.Continuation getContinuation() {
         return continuation;
     }
     

Modified: cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java?rev=786160&r1=786159&r2=786160&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/continuations/JettyContinuationWrapperTest.java
Thu Jun 18 16:58:12 2009
@@ -67,7 +67,7 @@
         cw.isNew();
         cw.isPending();
         cw.isResumed();
-        assertSame(ci, cw.getObject());
+        assertNull(cw.getObject());
         cw.setObject(userObject);
         cw.reset();
         cw.resume();

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java?rev=786160&r1=786159&r2=786160&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java
(original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/ClientServerWrappedContinuationTest.java
Thu Jun 18 16:58:12 2009
@@ -74,7 +74,7 @@
     }
 
     @Test
-    public void testHttpWrappedContinuatuions() throws Exception {
+    public void testHttpWrappedContinuations() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
         Bus bus = bf.createBus(CLIENT_CONFIG_FILE);
         BusFactory.setDefaultBus(bus);
@@ -115,6 +115,10 @@
         executor.shutdownNow();
         assertEquals("Not all invocations have been resumed", 0, controlDoneSignal.getCount());
         assertEquals("Not all invocations have completed", 0, helloDoneSignal.getCount());
+        
+        helloPort.sayHi("Dan1", "to:100");
+        helloPort.sayHi("Dan2", "to:100");
+        helloPort.sayHi("Dan3", "to:100");
     }
     
     

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java?rev=786160&r1=786159&r2=786160&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java
(original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http_jetty/continuations/HelloImplWithWrapppedContinuation.java
Thu Jun 18 16:58:12 2009
@@ -54,7 +54,11 @@
                 Object userObject = secondName != null && secondName.length() >
0 
                                     ? secondName : null;
                 continuation.setObject(userObject);
-                suspendInvocation(firstName, continuation);
+                long timeout = 20000;
+                if (secondName.startsWith("to:")) {
+                    timeout = Long.parseLong(secondName.substring(3));
+                }
+                suspendInvocation(firstName, continuation, timeout);
             } else {
                 StringBuilder sb = new StringBuilder();
                 sb.append(firstName);
@@ -99,9 +103,9 @@
         }
     }
     
-    private void suspendInvocation(String name, Continuation cont) {
+    private void suspendInvocation(String name, Continuation cont, long timeout) {
         try {
-            cont.suspend(20000);    
+            cont.suspend(timeout);    
         } finally {
             synchronized (suspended) {
                 suspended.put(name, cont);



Mime
View raw message