Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

is JAX-WS Service / getPort thread safe / best practices

600732Jul 29 2011 — edited Aug 3 2011
Hi Java developers.

I have a multi-threaded web service client using JAX-WS 2.x (using the JRE 6 version).
I am not really sure, what is thread-safe and what is not.

What are the best practices?

at the moment I create one Singleton Service. Then each thread of execution (actually each web service call) uses getPort() to get an instance of the port.

Do I need to be concerned about the calls to getPort()? do I need a Port instance for each thread, or is 1 instance of getPort sufficient for all threads?

Are you using some kind of Pool for the Ports? The getPort() method seems to execute quite quickly (sometimes a bit slow the first time though).

[url http://stackoverflow.com/questions/2465928/is-it-safe-to-reuse-javax-xml-ws-service-objects]Here is someone else asking the same question. Unfortunately the java.net forum link is dead.

[url http://209.132.182.49/message/526305]I see in other JAX-WS implementations the subject is somewhat unclear:

Thanks in advance.

Martin.

Edited by: mac24nz on Jul 29, 2011 8:55 AM

Edited by: mac24nz on Jul 29, 2011 8:58 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 31 2011
Added on Jul 29 2011
4 comments
7,515 views