Author: sergeyb
Date: Wed Jul 10 13:10:08 2013
New Revision: 1501755
URL: http://svn.apache.org/r1501755
Log:
Releasing contexts if AsyncResponse is not immediately processed
Modified:
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
Modified:
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java?rev=1501755&r1=1501754&r2=1501755&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
(original)
+++
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
Wed Jul 10 13:10:08 2013
@@ -189,8 +189,12 @@ public class JAXRSInvoker extends Abstra
asyncResponse =
(AsyncResponseImpl)inMessage.get(AsyncResponse.class);
}
result = invoke(exchange, resourceObject, methodToInvoke, params);
- if (asyncResponse != null &&
!asyncResponse.suspendContinuationIfNeeded()) {
- result = handleAsyncResponse(exchange, asyncResponse);
+ if (asyncResponse != null) {
+ if (!asyncResponse.suspendContinuationIfNeeded()) {
+ result = handleAsyncResponse(exchange, asyncResponse);
+ } else {
+ providerFactory.clearThreadLocalProxies();
+ }
}
} catch (Fault ex) {
Object faultResponse;
Modified:
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java?rev=1501755&r1=1501754&r2=1501755&view=diff
==============================================================================
---
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
(original)
+++
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
Wed Jul 10 13:10:08 2013
@@ -58,6 +58,16 @@ public abstract class AbstractJAXRSConti
}
@Test
+ public void testImmediateResumeSubresource() throws Exception {
+ WebClient wc = WebClient.create("http://localhost:" + getPort()
+ +
"/bookstore/books/subresources/books/resume");
+
WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(1000000L);
+ wc.accept("text/plain");
+ String str = wc.get(String.class);
+ assertEquals("immediateResume", str);
+ }
+
+ @Test
public void testGetBookNotFound() throws Exception {
WebClient wc = WebClient.create("http://localhost:" + getPort() +
"/bookstore/books/notfound");
wc.accept("text/plain");