You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Colm O hEigeartaigh <co...@apache.org> on 2019/06/17 12:03:41 UTC

Re: [cxf] branch master updated: [CXF-8055]AsyncHTTPConduit should also consider jaxws spec timeout properties

Hi Freeman,

I don't understand the logic below - why is it only setting the timeouts if
they are equal to a certain value?

Colm.

On Thu, Jun 13, 2019 at 8:25 PM <ff...@apache.org> wrote:

>
> +    private void propagateJaxwsSpecTimeoutSettings(Message message,
> HTTPClientPolicy csPolicy) {
> +        int receiveTimeout = determineReceiveTimeout(message, csPolicy);
> +        if (csPolicy.getReceiveTimeout() == 60000) {
> +            csPolicy.setReceiveTimeout(receiveTimeout);
> +        }
> +        int connectionTimeout = determineConnectionTimeout(message,
> csPolicy);
> +        if (csPolicy.getConnectionTimeout() == 30000) {
> +            csPolicy.setConnectionTimeout(connectionTimeout);
> +        }
> +    }
>



> +
>
>      protected OutputStream createOutputStream(Message message,
>                                                boolean needToCacheRequest,
> diff --git
> a/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java
> b/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java
> index ed20f7b..9ed69af 100644
> ---
> a/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java
> +++
> b/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java
> @@ -154,6 +154,21 @@ public class AsyncHTTPConduitTest extends
> AbstractBusClientServerTestBase {
>              //expected!!!
>          }
>      }
> +
> +
> +    @Test
> +    public void testTimeoutWithPropertySetting() throws Exception {
> +        ((javax.xml.ws
> .BindingProvider)g).getRequestContext().put("javax.xml.ws.client.receiveTimeout",
> +            "3000");
> +        updateAddressPort(g, PORT);
> +
> +        try {
> +            assertEquals("Hello " + request, g.greetMeLater(-5000));
> +            fail();
> +        } catch (Exception ex) {
> +            //expected!!!
> +        }
> +    }
>
>      @Test
>      public void testTimeoutAsync() throws Exception {
> @@ -168,6 +183,21 @@ public class AsyncHTTPConduitTest extends
> AbstractBusClientServerTestBase {
>              //expected!!!
>          }
>      }
> +
> +    @Test
> +    public void testTimeoutAsyncWithPropertySetting() throws Exception {
> +        updateAddressPort(g, PORT);
> +        ((javax.xml.ws
> .BindingProvider)g).getRequestContext().put("javax.xml.ws.client.receiveTimeout",
> +            "3000");
> +        try {
> +            Response<GreetMeLaterResponse> future =
> g.greetMeLaterAsync(-5000L);
> +            future.get();
> +            fail();
> +        } catch (Exception ex) {
> +            //expected!!!
> +        }
> +    }
> +
>      @Test
>      public void testConnectIssue() throws Exception {
>          updateAddressPort(g, PORT_INV);
>
>

-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Re: [cxf] branch master updated: [CXF-8055]AsyncHTTPConduit should also consider jaxws spec timeout properties

Posted by ffang <fr...@gmail.com>.
Hi Colm,

60000 and 30000 are the default timeout of HTTPClientPolicy for receiveTimeout and connecionTimeout separately.

Users can actually set this timeout in different places, like from HTTPClientPolicy from JAXWS spec properties.

My idea here is that the one set in HTTPClientPolicy explicitly should overrule the one from JAXWS spec properties(to keep the default behavior as without this change, since JAXWS spec properties don’t work for a long time so I believe most users use HTTPClientPolicy to configure timeout they want).

That’s why I set timeout from JAXWS spec properties only if the timeout in HTTPClientPolicy isn’t the default one.

-------------
Freeman(Yue) Fang

Red Hat, Inc. 





> On Jun 17, 2019, at 8:03 AM, Colm O hEigeartaigh <co...@apache.org> wrote:
> 
> Hi Freeman,
> 
> I don't understand the logic below - why is it only setting the timeouts if they are equal to a certain value?
> 
> Colm.
> 
> On Thu, Jun 13, 2019 at 8:25 PM <ffang@apache.org <ma...@apache.org>> wrote:
> 
> +    private void propagateJaxwsSpecTimeoutSettings(Message message, HTTPClientPolicy csPolicy) {
> +        int receiveTimeout = determineReceiveTimeout(message, csPolicy);
> +        if (csPolicy.getReceiveTimeout() == 60000) {
> +            csPolicy.setReceiveTimeout(receiveTimeout);
> +        }
> +        int connectionTimeout = determineConnectionTimeout(message, csPolicy);
> +        if (csPolicy.getConnectionTimeout() == 30000) {
> +            csPolicy.setConnectionTimeout(connectionTimeout);
> +        }
> +    }
> 
>  
> +
> 
>      protected OutputStream createOutputStream(Message message,
>                                                boolean needToCacheRequest,
> diff --git a/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java b/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java
> index ed20f7b..9ed69af 100644
> --- a/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java
> +++ b/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java
> @@ -154,6 +154,21 @@ public class AsyncHTTPConduitTest extends AbstractBusClientServerTestBase {
>              //expected!!!
>          }
>      }
> +    
> +    
> +    @Test
> +    public void testTimeoutWithPropertySetting() throws Exception {
> +        ((javax.xml.ws <http://javax.xml.ws/>.BindingProvider)g).getRequestContext().put("javax.xml.ws.client.receiveTimeout",
> +            "3000");
> +        updateAddressPort(g, PORT);
> +        
> +        try {
> +            assertEquals("Hello " + request, g.greetMeLater(-5000));
> +            fail();
> +        } catch (Exception ex) {
> +            //expected!!!
> +        }
> +    }
> 
>      @Test
>      public void testTimeoutAsync() throws Exception {
> @@ -168,6 +183,21 @@ public class AsyncHTTPConduitTest extends AbstractBusClientServerTestBase {
>              //expected!!!
>          }
>      }
> +    
> +    @Test
> +    public void testTimeoutAsyncWithPropertySetting() throws Exception {
> +        updateAddressPort(g, PORT);
> +        ((javax.xml.ws <http://javax.xml.ws/>.BindingProvider)g).getRequestContext().put("javax.xml.ws.client.receiveTimeout",
> +            "3000");
> +        try {
> +            Response<GreetMeLaterResponse> future = g.greetMeLaterAsync(-5000L);
> +            future.get();
> +            fail();
> +        } catch (Exception ex) {
> +            //expected!!!
> +        }
> +    }
> +    
>      @Test
>      public void testConnectIssue() throws Exception {
>          updateAddressPort(g, PORT_INV);
> 
> 
> 
> -- 
> Colm O hEigeartaigh
> 
> Talend Community Coder
> http://coders.talend.com <http://coders.talend.com/>