Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7051119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:13:32+00:00 2026-05-28T03:13:32+00:00

Do you know how costly is to create a webservice client service instance ?

  • 0

Do you know how costly is to create a webservice client service instance ?

 JavaWebService service = new JavaWebService();
 SomePort port = service.getJavaWebServicePort(); 

Creating the service once and after that reusing same port in a multi threaded environment (webapp) is not dangerous ?

Read that the port getPort and port itself is not thread safe but also creating each time a service it might be problematic if it is a costly operation.

Any idea ?

THanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:13:33+00:00Added an answer on May 28, 2026 at 3:13 am

    In the JAX-WS reference implementation (Metro), the creation of the JavaWebService is inexpensive (in our generated clients, we tend to find this takes around 20ms).

    The first creation of SomePort is quite expensive (circa 200ms for us); subsequent calls to getSomePort() on the same JavaWebService instance are substantially quicker (circa 3ms for us).

    So, an implementation that creates a JavaWebService every time it needs to get a SomePort will carry a degree of expense. In short, the answer to the question is “Quite costly”.

    However, even though the methods on SomePort are not thread safe, the methods on JavaWebService are. So, the sensible usage pattern (at least with Metro – thread-safety is implementation specific due to a somewhat lacking specification) is to reuse JavaWebService as you will only incur the expensive getSomePort() call once.

    Update

    This agrees with two posts by Andreas Leow, an employee from Oracle Germany, one of the posters in the thread referenced by @PapaLazarou in the comment below, who wrote regarding the Service object,

    You can create just one single static Service instance per WSDL: any single Service object is fully thread-safe and can be shared by as many concurrent threads as you like.

    and about the usage of ports,

    While I am almost 100% certain that CXF JAX-WS Ports are thread-safe, Metro’s Port objects definitely are not thread-safe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that IDataReader is a interface so I can't create an instance of
I know that accessing and manipulating the DOM can be very costly, so I
I am running creating an iPhone application which performs a costly operation and I
I know strings in Erlang can be costly to use. So how do I
I know that in JavaScript, creating a for loop like this: for(int i =
I remember that my professor said that new operation is the most costly operation
Know of an OCAML/CAML IDE? Especially one that runs on Linux?
Know of any good libraries for this? I did some searches and didn't come
Know this might be rather basic, but I been trying to figure out how
Know if it's possible to access the iPhone compass in Safari using JavaScript? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.