Apache CXF不释放客户端

编程入门 行业动态 更新时间:2024-10-26 22:27:50
本文介绍了Apache CXF不释放客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我发现我的应用程序严重泄漏内存.进行堆转储后,似乎Apache CXF(2.7.7)似乎引用了许多JaxWsServiceConfiguration(一天14000).

I've discovered my application is heavily leaking memory. After taking heap dumps it appears Apache CXF (2.7.7) seems to be referencing lots of JaxWsServiceConfiguration (14000 in a day).

我不确定是否正确使用它,是否需要以某种方式释放客户端或CXF中是否有错误.希望有人可以在这里指出正确的方向.

I'm not sure if I am using it correctly, whether I need to somehow release the client or there is a bug in CXF. Hopefully somebody can point me in the right direction here.

我正在使用JaxWsProxyFactoryBean注入我的服务方法中.调用以下行来创建客户端代理(对Web服务的每个请求都需要调用):

I am using a JaxWsProxyFactoryBean injected into my service methods. The following line is called to create the client proxy (called for every request to the web service):

jaxWsProxyFactoryBean.create();

服务方法最终完成了,但是看起来工厂持有对客户端代理的引用,因此从不对它进行GC.

Eventually the service method finishes but it looks like the factory holds reference to the client proxy and therefore never GCs it.

我以为我可以创建一个静态客户端并始终使用它,但是对此有些不安,因为它并非在所有情况下都是线程安全的: cxf.apache/faq.html#FAQ-AreJAX-WSclientproxiesthreadsafe ?

I thought I could create a single static client and always use this but am a little nervous of this since it is not thread-safe in all circumstances: cxf.apache/faq.html#FAQ-AreJAX-WSclientproxiesthreadsafe?

我应该做些不同的事情吗?

Should I be doing this differently?

推荐答案

在构建网关以代表数百个并发客户端使用Web服务时,我始终使用静态代理.只要不针对给定请求修改拦截器链,例如修改管道或使用会话,都应该没有问题.

I use static proxies all the time when I build gateways to consume a web service on behalf of hundreds of concurrent clients. It should be no problem whatsoever as long as the interceptor chain is not modified for a given request, for example modification to the conduit or use of sessions.

更多推荐

Apache CXF不释放客户端

本文发布于:2023-10-26 10:57:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1529936.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:客户端   Apache   CXF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!