问题
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