Quantcast

How to reuse cxf resources and underline HTTP connection?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to reuse cxf resources and underline HTTP connection?

Sigmund God
A typical CXF init codes in client look like this:

ClientProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> factory.setServiceClass(Service.class);
> factory.setAddress(address);
> Service service = (Service) factory.create();
> Client client = ClientProxy.getClient(service);
> HTTPConduit conduit = (HTTPConduit) client.getConduit();
> HTTPClientPolicy policy = conduit.getClient();
> policy.setConnectionTimeout(60000);
> policy.setReceiveTimeout(60000);
> conduit.setClient(policy);


My question is, what instance can be reused if I need to call many web
services?
seems like ClientProxyFactoryBean cannot be reused because every instance
of it  is coressponding to a particular Service.
I guess instance of Service here is the only instance can be reused, am I
correct?

Another question is, what's the proper values of various timeout of
HTTPClientPolicy?

Most important, how can I reused HTTP connection that CXF created?

Many questions here, but point is, how can reduce resource occupy of CXF
asap?

Thanks u all very much.

Bests.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to reuse cxf resources and underline HTTP connection?

Sigmund God
Any any help me, pls?

Thank u so much!

On Wed, May 10, 2017 at 4:27 PM, Sigmund God <[hidden email]> wrote:

> A typical CXF init codes in client look like this:
>
> ClientProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>> factory.setServiceClass(Service.class);
>> factory.setAddress(address);
>> Service service = (Service) factory.create();
>> Client client = ClientProxy.getClient(service);
>> HTTPConduit conduit = (HTTPConduit) client.getConduit();
>> HTTPClientPolicy policy = conduit.getClient();
>> policy.setConnectionTimeout(60000);
>> policy.setReceiveTimeout(60000);
>> conduit.setClient(policy);
>
>
> My question is, what instance can be reused if I need to call many web
> services?
> seems like ClientProxyFactoryBean cannot be reused because every instance
> of it  is coressponding to a particular Service.
> I guess instance of Service here is the only instance can be reused, am I
> correct?
>
> Another question is, what's the proper values of various timeout of
> HTTPClientPolicy?
>
> Most important, how can I reused HTTP connection that CXF created?
>
> Many questions here, but point is, how can reduce resource occupy of CXF
> asap?
>
> Thanks u all very much.
>
> Bests.
>
Loading...