You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Itamar_t <it...@hedgehocpoker.com> on 2011/07/24 19:24:02 UTC

reusing service/port instance

Hi,

when using CXF, I'm doing smth like this:

	        SomeService ss = new SomeService(wsdlURL, SERVICE_NAME);
	        ISomeService port = ss.getBasicHttpBindingISomeService();
                //use the port

currently the service and port are created for eah remote method invocation.
should I create the service and the port every time? or should I create the
service (or the port) in a broader scope and re use it? and if so, is it
safe to use the same service (or port) from multiple threads? 
Thanks in advance

--
View this message in context: http://cxf.547215.n5.nabble.com/reusing-service-port-instance-tp4628346p4628346.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: reusing service/port instance

Posted by Daniel Kulp <dk...@apache.org>.
On Sunday, July 24, 2011 10:24:02 AM Itamar_t wrote:
> Hi,
> 
> when using CXF, I'm doing smth like this:
> 
> 	        SomeService ss = new SomeService(wsdlURL, SERVICE_NAME);
> 	        ISomeService port = ss.getBasicHttpBindingISomeService();
>                 //use the port
> 
> currently the service and port are created for eah remote method invocation.
> should I create the service and the port every time? or should I create the
> service (or the port) in a broader scope and re use it? and if so, is it
> safe to use the same service (or port) from multiple threads?


Some of this is in the FAQ:

http://cxf.apache.org/faq.html#FAQ-AreJAXWSclientproxiesthreadsafe%3F


Basically, it's up to you.   In general, I would suggest a single "port" and 
use it for everything, but if you hit some of the caveats mentioned in the 
FAQ, using a pool of them is also quite manageable.

Dan



> Thanks in advance
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/reusing-service-port-instance-tp4628346p462
> 8346.html Sent from the cxf-user mailing list archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com