CXF客户端代理线程安全吗? [英] Are CXF client proxies thread safe?

查看:279
本文介绍了CXF客户端代理线程安全吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CXF生成SOAP客户端类.他们在 CXF文档中编写

I'm using CXF to generate SOAP client classes. In the CXF documentation, they write

JAX-WS客户端代理线程安全吗?

Are JAX-WS client proxies thread safe?

JAX-WS官方回答:否.根据JAX-WS规范,客户端代理不是线程安全的.要编写可移植的代码,您应该将它们视为非线程安全的并同步访问或使用实例池或类似池.

Official JAX-WS answer: No. According to the JAX-WS spec, the client proxies are NOT thread safe. To write portable code, you should treat them as non-thread safe and synchronize access or use a pool of instances or similar.

CXF答案:对于许多用例,CXF代理都是线程安全的.例外是:

CXF answer: CXF proxies are thread safe for MANY use cases. The exceptions are:

(我省略了他们对这些用例的描述)

(I'm omitting their description of these use cases)

对于大多数简单"用例,可以在多个线程上使用CXF代理.上面概述了其他解决方法.

For most "simple" use cases, you can use CXF proxies on multiple threads. The above outlines the workarounds for the others.

有人有相反的经历吗?遇到常见问题中未描述的多线程问题吗?还是它们的描述准确无误,并且基本上可以安全使用?

Does anyone have any contrary experiences? Encountered multi-threading issues that aren't described in their faq? Or is their description accurate and they are basically safe to use?

推荐答案

我们最近在我们的项目中遇到了类似的讨论. 正如您在FAQ中所指定的那样,除了可以即时修改HTTP管道的功能(例如:会话管理和故障转移功能)以外,CXF客户端代理是线程安全的. 因此,如果您不使用这些功能,则可以在线程之间共享客户端代理.

We recently ran into similar discussion in our project. As specified in the FAQ you are referring to, except for the features that modify HTTP conduit on the fly (ex: session management and failover features), the CXF client proxy is thread safe. So if you do not use these features then it is okay to share the client proxy between threads.

这篇关于CXF客户端代理线程安全吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆