Hi Unreal, One point to note is that all the other JAX-WS Handler touch points are driven through a set of interceptors, each wrapping a chain of a particular Handler type (logical, protocol etc.).
So for example the SOAPHanderInterceptor takes care of calling the handleMessage/Fault() methods of any SOAPHandlers in the chain. Similarly there's a *separate* LogicalHandlerInterceptor that traverses the chain of LogicalHandlers. I'm guessing you already know all this ... But the point is that it would be a good idea to maintain the pattern of wrapper-interceptor calling out to JAX-WS Handler, and obviously it would be badness to for example put this JAXWS-specific logic into the ClientImpl code. However, because Handler.close() should only be called at the very *end* of the interceptor chain tarversal, and because we currently have *multiple* interceptors wrapping the JAX-WS Handler chains of various types, the close() call should not be made from within the existing wrapper interceptors. Otherwise we'd end up with for example close() called prematurely on the SOAPHandlers *before* the LogicalHandlers have even been traversed (inbound on the client-side). So we'd need a *single* new wrapper interceptor, positioned at the end of the in & fault-in interceptor chains, that's responsible for calling close() on all types of handler. This could be driven via a pattern similar to the LogicalHandlerInterceptor.onCompletion() method (e.g. the new interceptor walks back along the chain to find the LogicalHandlerInterceptor & SOAPHandlerInterceptor and calls onCompletion() on these). Cheers, Eoghan > -----Original Message----- > From: Unreal Jiang [mailto:[EMAIL PROTECTED] > Sent: 17 January 2007 11:39 > To: [email protected] > Subject: RE: When should we close the handlers in CXF? > > Hi Jervis, > > Thanks for your reply. > > I agree to you idea. Maybe there have some resources > assigned in REQUEST message handlers should be shared by > RESPONSE message handlers. So we should close handlers just > at the end of a MEP, and client side once, server side once. > > Cheers > Unreal > > > "Liu, Jervis" <[EMAIL PROTECTED]> wrote: Hi Unreal, > > My understanding is that the handler's close method should be > called at the end of a MEP. See below from JAX-WS section 9.3.2.3: > > "A handler's close method is called at the conclusion of a > message exchange pattern (MEP). It is called just prior to > the binding dispatching the final message, fault or > exception of the MEP and may be used to clean up per-MEP > resources allocated by a handler." > > For example for a request-response MEP, on the client side, > close method should be called at the end of inbound > interceptor chain (when client receives the reponse), on the > server side close method should be called at the end of > outbound interceptor chain. Havn't got chance to check Sun's > RI code, but I do not think it conforms to spec if the close > method are called four times in a standard request-reponse MEP. > > Cheers, > Jervis > > ________________________________ > > From: Unreal Jiang [mailto:[EMAIL PROTECTED] > Sent: Tue 1/16/2007 9:34 PM > To: [email protected] > Subject: When should we close the handlers in CXF? > > > > Hi guy, > In JAX-WS spec, it describe that A handler's close method > is called at the conclusion of a message exchange pattern (MEP). > How can we apprehend it? Does it mean that we should close > handlers when the response is returned to client? > > > But in sun's ri, it close handlers at handlers process > finished such as outband & inbound handler chain finished at > both client and server side, so there have four times close > in a request-response MEP. > > Do you guys have any idea about Which approach is conform to spec? > > > Any comment will be appreciated. > > Cheers > Unreal > > --------------------------------- > Any questions? Get answers on any topic at Yahoo! Answers. > Try it now. > > > > > --------------------------------- > Don't get soaked. Take a quick peak at the forecast with > theYahoo! Search weather shortcut. >
