Ah, thank you.
How can I set the maxIdleTime without using Spring?

In the code I'm using the JettyHttpServerEngine and the Connector are both 
created during serverFactory.create - and the maxIdleTime is only used when 
creating the Connector.

Jim

On Wed, Dec 14, 2011 at 02:23:30PM +0800, Freeman Fang wrote:
> Hi,
> 
> Yeah, I've encountered same issue before.
> 
> The key reason of this behavior is that on the server side the service  
> process take a very long time, let's say 10 mins, so the connection  
> between client and server become kinda of idle, for me in this case  
> only configure client side connectionTimeout and receiveTimeOut isn't  
> enough, we also need configure jetty server connector to set a longer  
> maxIdleTime(the default value is 200 sec, that's why you see resend  
> every 200 sec) which can honor this long connection idle,
> 
> If you use more recent released cxf version(2.3.7,2.4.3, 2.5) then you  
> can specify the maxIdleTime on JettyHttpServerEngine directly, we have  
> a issue CXF-3833[1] to track it
> 
> If you use some old cxf version, I believe the httpj:connector here[2]  
> should also work, you need add a httpj:connector and specify  
> maxIdleTime for it
> 
> [1]https://issues.apache.org/jira/browse/CXF-3833
> [2]http://cxf.apache.org/docs/jetty-configuration.html
> 
> Freeman
> 
> On 2011-12-14, at 上午3:25, Jim Talbut wrote:
> 
> > Hi,
> >
> > I've got a SOAP operation that takes a long time to complete (in  
> > fact, I expect it to timeout, but I need that controlled by my code  
> > server side so it's not relevant to this).
> > When I call the operation it blocks, as expected, but then after  
> > ~200s I see the operation called again.
> > It isn't called by my code, so I think it's happening within CXF  
> > somewhere, but I can't work out where.
> >
> > My web service client is set up like this:
> >        proxyFactory = new JaxWsProxyFactoryBean();
> >        proxyFactory.setServiceClass(IGenericConversion.class);
> >        proxyFactory.setAddress( url );
> >
> >        client = (IGenericConversion)proxyFactory.create();
> >        BindingProvider binder = ( BindingProvider ) client;
> >
> >        HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
> >        httpClientPolicy.setConnectionTimeout( 10000 );
> >        httpClientPolicy.setAllowChunking( false );
> >        httpClientPolicy.setReceiveTimeout( 600 * 1000 );
> >        httpClientPolicy.setMaxRetransmits( 0 );
> >        // httpClientPolicy.setProxyServer( "localhost" );  //  
> > Fiddler, sometimes
> >        // httpClientPolicy.setProxyServerPort( 8888 );
> >
> >        HTTPConduit http = ( HTTPConduit )  
> > org.apache.cxf.frontend.ClientProxy.getClient( client ).getConduit();
> >        http.setClient( httpClientPolicy );
> > And called like this:
> >        log.debug( "{}: Requesting conversion of {} to {}", new  
> > Object[]{ request.getCorrelationId(), request.getFileName(),  
> > request.getDestinationFormat() } );
> >        ConversionResult result = client.convert( request );
> >
> > The server is set up like this:
> >        url = "http://localhost:"; + findFreePort() + "/pdf";
> >        log.debug( "Conversion web service URL: {}", url );
> >
> >        if( server == null ) {
> >            conversionService = new ConversionWebService();
> >            serverFactory = new JaxWsServerFactoryBean();
> >            serverFactory.setServiceClass(ConversionWebService.class);
> >            serverFactory.setAddress( url );
> >            serverFactory.setServiceBean( conversionService );
> >            server = serverFactory.create();
> >        }
> >        server.start();
> >        log.debug( "server is {}", server );
> >
> >        servletContext = new MockServletContext();
> >        servletContext.addInitParameter( "office.port",  
> > Integer.toString( findFreePort() ) );
> >        servletContext.addInitParameter( "office.instances", "1" );
> >        WebappContext.init(servletContext);
> >         
> > conversionService 
> > .setWebappContext( WebappContext.get( servletContext ) );
> > And the operation implementation contains this:
> >    public ConversionResult convert( ConversionRequest parameters ) {
> >
> >        try {
> >            ... // Parameter checking, no loops, honestly
> >        log.debug( "{}: Converting file \"{}\" to {} ({} bytes)", new  
> > Object[]{
> >                    parameters.getCorrelationId(),
> >                    parameters.getFileName(),
> >                    destinationFormat,
> >                    parameters.getContent().length
> >                } );
> >
> > And when I run it I'm getting:
> >    Line 704: 15:33:00.977 [main] DEBUG c.g.j.s.BaseWebServiceTest -  
> > [BaseWebServiceTest.java(224)  
> > BaseWebServiceTest::convertFileToResult] 841627bf-5d24-4d51-aef2- 
> > a12693e7850f: Requesting conversion of Tardis.docx to PDF
> >    Line 844: 15:33:01.157 [qtp1672848394-16 - /pdf] DEBUG  
> > c.g.j.s.ConversionWebService - [ConversionWebService.java(84)  
> > ConversionWebService::convert] 841627bf-5d24-4d51-aef2-a12693e7850f:  
> > Converting file "Tardis.docx" to PDF (32620 bytes)
> >    Line 886: 15:36:21.498 [qtp1672848394-18 - /pdf] DEBUG  
> > c.g.j.s.ConversionWebService - [ConversionWebService.java(84)  
> > ConversionWebService::convert] 841627bf-5d24-4d51-aef2-a12693e7850f:  
> > Converting file "Tardis.docx" to PDF (32620 bytes)
> >    Line 925: 15:36:51.504 [qtp1672848394-18 - /pdf] DEBUG  
> > c.g.j.s.ConversionWebService - [ConversionWebService.java(214)  
> > ConversionWebService::convert] 841627bf-5d24-4d51-aef2-a12693e7850f:  
> > Conversion complete, file "Tardis.docx" to "null" (0 bytes) took  
> > 30.005s: null
> >    Line 1094: 15:36:51.539 [qtp1672848394-16 - /pdf] DEBUG  
> > c.g.j.s.ConversionWebService - [ConversionWebService.java(214)  
> > ConversionWebService::convert] 841627bf-5d24-4d51-aef2-a12693e7850f:  
> > Conversion complete, file "Tardis.docx" to "null" (0 bytes) took  
> > 230.377s: null
> > Two calls to the implementation, 200s apart, but only one call from  
> > the client.
> >
> > I hope this is blindingly obvious to someone in the know 'cos it's  
> > driving me insane now.
> > Thanks.
> >
> > Jim
> 
> ---------------------------------------------
> Freeman Fang
> 
> FuseSource
> Email:[email protected]
> Web: fusesource.com
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> 
> 
> 
> 
> 
> 
> 
> 
> 

Reply via email to