Hi Dennis,

Thank you so much for your prompt response.

"A bean per service", this mean I can declare my service as a instance
variable and reuse it for every call on this service, it is thread-safe,
right?

Current I'm working on a project that using cxf as webservice
implementation. I found out this code:

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);
>

are writing within a method of service, so will create service everytime
when u call it!

I think maybe I can declare Service as a instance variable, only
instantiate one time,  and reuse it for upcome invoke.

That's why I want to know if those codes are thread-safe.

Thanks again.

Best regards.
--Sig


On Tue, May 23, 2017 at 4:39 PM, Dennis Kieselhorst <[email protected]> wrote:

> Hi Sigmund,
>
> it's not clear what you want to optimize. You need a bean per service.
>
> Do you want to use some kind of HTTP connection pooling? Check if
> Keep-Alive is working properly.
>
> You can specify the timeout properties as described in the documentation:
> http://cxf.apache.org/docs/client-http-transport-
> including-ssl-support.html#ClientHTTPTransport(includingSSLsupport)-
> Theclientelement
>
> Regards
> Dennis
>

Reply via email to