Thank you, Jervis and Andrea.

I think probably the last part of Andrea's response comes closest to the sort of thing I need:

You can also have an interceptor installed at bus level which, when executing, adds further interceptors to the chain, possibly on a per message basis. This is done for example in org.apache.cxf.ws.policy.ClientPolicyOutInterceptor.

(Jervis, I see what the code you referenced is doing, but does an ordinary developer like myself have a hook into the creation of an Endpoint? The code you reference seems to be a special case of installing a BindingFactory into an Endpoint, which is part of the CXF plumbing. I'm looking for something more in userland, as they say. Unless I'm missing something -- please correct me if I am.)

The issue is that I want to programatically install these interceptors from plugin (i.e., spring-loaded) code, but it looks like there's really no way to do that. Andrea's solution (if I understand it -- apologies if I'm being thick) is to install an interceptor during the servicing of a request, which works, though I'd hoped I could avoid that sort of overhead -- it's something I really only need to do once, at the point at which the operative InterceptorProvider is being set-up or established.

Also, if interceptors are being added in the course of servicing a request, does one have to take special care of thread-safety issues? I understand the InterceptorProvider returns you a List by reference, not a copy, so you are free to add, delete, traverse elements, etc. But if you're in the context of a request, is there any mechanism to lock access to the interceptor list, so that someone else in your application with the same devious plan won't walk over the same data at the same time? Am I completely missing something about the architecture, here? It seems like modifying an interceptor list in flight has ConcurrentModification exceptions written all over it.

Thanks,
-Fred

Reply via email to