JAX-WS RI 中创建了多少个 Web 服务对象?
当我使用“@WebService”注释 Java 类并将其与 JAX-WS RI(“Metro”)一起使用时,JAX-WS RI 会创建多少个我的类的对象? 是否始终最多有一个对象,或者(可能取决于使用情况)是否可以创建更多实例?
When I annotate a Java class with "@WebService" and use it with JAX-WS RI ("Metro"), how many objects of my class does the JAX-WS RI create? Is there at most one object at all times or (perhaps depending on usage) can there be more instances be created?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JAX-WS 标准是否指定了这一点?
我希望这与 Servlet 非常相似,其中标准没有说明服务器只是为应用程序创建一个 Servlet 对象,或者为每个请求创建一个 Servlet 对象。 如果是这样,那么您不应构建程序来对 JAX-WS 实现的工作原理做出假设。
这就是我建议的任何一种方式:编写代码,使这个问题没有实际意义。 然后您就可以确定不会遇到意外,并且即使新的实现碰巧以不同的方式执行操作,您也可以将 Metro 切换为其他功能。
Does the JAX-WS standard specify this?
I would expect this to be pretty much like Servlets, where the standard does not state of the server just creates one Servlet object for the application, or one for every request. If so, then you should not build your program such that it makes assumptions about how the JAX-WS implementation works.
And that is what I would recommend either way: write your code such that this question is moot. Then you're certain that you won't run into surprises, and you will be able to switch out Metro for something else even if the new implementation happens to do things differently.