Poyraz
Poyraz

Reputation: 359

jax-ws client with using singleton pattern

I have a java ee app, there is a jax-ws client in the app, At the beginnig of each request to my app I use that jax-ws client, If I implement the jax-ws client as a singleton, can i improve the performance ?

Upvotes: 0

Views: 523

Answers (1)

Pantelis Natsiavas
Pantelis Natsiavas

Reputation: 5369

As Steve McConell suggests you should not make architectural decisions based on slight performance improvement speculations. Instantiating an object once, comparing with instatiating it over and over again would of course lead to performance improvement.

Nevertheless, I suppose that if you don't instantiate thousands of jax-ws clients per second, your performance would not improve in a way that would justify the architectural change. Anyway, you should measure the performance overhead of the jax-ws instatiation and then decide if it's worth the trouble.

Hope I helped!

Upvotes: 1

Related Questions