Can really I wire a reference to the web service into an interceptor?

为君一笑 提交于 2019-12-13 01:12:30

问题


I'm new to both CXF and Web Services.

So CXF creates a new interceptor stack for each request according to docs. I want to snag the SOAP, payload and all, and have it available for persistence to an exception table. I've written an interceptor based on LoggingInterceptor that will likely work fine and my IDE says the wiring is fine, my concern is threading and / or when the Web Service is created.

For some reason I have this nagging doubt that this is going to work and that it has to do with threading. I just can't put my finger on it though.


回答1:


CXF creates a new "PhaseInterceptorChain" object per request, but the interceptors themselves are not created per request. Thus, using a singleton for the interceptor is perfectly OK providing you make sure the handleMessage (and handleFault) methods are properly thread safe.



来源:https://stackoverflow.com/questions/12465963/can-really-i-wire-a-reference-to-the-web-service-into-an-interceptor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!