简体   繁体   中英

jax-ws client with using singleton pattern

我有一个Java EE应用程序,应用程序中有一个jax-ws客户端,在对我的应用程序的每个请求的开始处,我都使用该jax-ws客户端,如果我将jax-ws客户端实现为单例,我可以改进吗?性能?

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM