cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: service creation & busfactory going to impact performance?
Date Mon, 08 Dec 2008 21:42:44 GMT


It really should have no impact.   The default if you don't set it is to call 
BusFactory.getDefaultBus() anyway. 

My suggestion would be one of:
1) Keep one of your BasicReportService objects around.   If you keep it 
around, the JAXBContext and such can be cached so it doesn't need to be 
recreated.   That's part of the slowdown.

2) Just use a single BasicReportService object.   Don't create a new one each 
time.   Call:
((BindingProvider)ret).getRequestContext().put(
    "thread.local.request.context", Boolean.TRUE);
and it will flip it to ThreadLocal storage for the request context which 
allows it to be mostly threadsafe (unless you turn on session support).   Set 
the URL as needed via 
((BindingProvider)ret).getRequestContext().put(
         BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
         aServiceURL);


Dan




On Monday 08 December 2008 3:54:04 pm nmt999 wrote:
> Below is the code i use for creating service. Would it impact the memory or
> performance if I use or do not use the setBus line that is commented. This
> cxf client seems to take more time to run than the existing axis client and
> also seems to use high cpu. not sure if i'm doing anything wrong. Also
> these services get created for each account that the service is used for as
> the service url differs from account to account
>
>
>     public BasicReportService createService(String aServiceURL)
>     {
>         BasicReportService ret = null;
>
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.getInInterceptors().add(new LoggingInInterceptor());
>         factory.getOutInterceptors().add(new LoggingOutInterceptor());
>         factory.setServiceClass(BasicReportService.class);
>         factory.setAddress(aServiceURL);
> 	// factory.setBus(BusFactory.getDefaultBus());
>
>         ret = (BasicReportService) factory.create();
>
>         Client client = ClientProxy.getClient(ret);
>         HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
>
>         HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
>
> httpClientPolicy.setConnectionTimeout(theService.DEFAULT_API_CONNECT_TIMEOU
>T);
>
> httpClientPolicy.setReceiveTimeout(theService.DEFAULT_API_READ_TIMEOUT);
>         httpClientPolicy.setAllowChunking(false);
>
>         httpConduit.setClient(httpClientPolicy);
>
>         Debug.msg(Debug.INFORMATION, "BasicReportService created");
>         return ret;
>     }



-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Mime
View raw message