java - @Endpoint 注解的类处理来自多个客户端的请求,它可以是异步的吗?

标签 java spring web-services synchronous

在我正在处理的一个Spring项目中,有一个用@Endpoint注释的类,并且方法用@PayloadRoot注释。在我看来,它的工作方式是同步处理请求,并且在返回对先前请求的响应之前不会处理下一个请求。

在有来自多个客户端的请求的情况下,我们如何提高性能?

谢谢, 约翰

最佳答案

每个 @Endpoint 类的作用域都是单例,可以处理来自多个客户端的请求,因此每个类都有一个线程。

查看http://docs.spring.io/spring-ws/site/reference/html/server.html中的注释:

Endpoints, like any other Spring Bean, are scoped as a singleton by default, i.e. one instance of the bean definition is created per container. Being a singleton implies that more than one thread can use it at the same time, so the endpoint has to be thread safe. If you want to use a different scope, such as prototype, refer to the Spring Reference documentation.

Note that all abstract base classes provided in Spring-WS are thread safe, unless otherwise indicated in the class-level Javadoc.

关于java - @Endpoint 注解的类处理来自多个客户端的请求,它可以是异步的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27832258/

相关文章:

java - 我们如何为 log4j2 日志级别而不是环境变量设置默认值

Java:生成不重复数字的数字列表?

java - 保存在属性文件中的数据源设置直到重启后才加载

java - spring和spring security有没有什么好的入门电子资料或者网站?

.net - 当我的老板说堆栈时他在说什么?

c# - 如何从 ssl 证书和签名属性调用 Soap web 服务

java - JSP - 验证复选框按钮导致加载时间长?

java - 如何为 Dagger 的类(与接口(interface))注入(inject)模拟

java - 使用简单的 spring-data-rest 项目获取 404 错误

java - Jersey 中的请求过滤器更改 httpheader