Alan D. Cabrera wrote:
Sounds interesting but kinda slow. Do I have to go through all those
iterators to get my call done?
I agree.. sounds too heavy weight.
Regards,
Alan
-----Original Message-----
From: gianny DAMOUR [mailto:[EMAIL PROTECTED]
Sent: Monday, November 24, 2003 5:36 AM
To: [EMAIL PROTECTED]
Subject: Re: Proposal: Change the way interceptors are stacked
Jeremy Boynes wrote:
Currently the interceptor stack is built from the front backwards
using
the
addInterceptor method on the container.
I would like to propose we change to build the stack in the opposite
order,
from the back forward.
Is it possible to have a bi-directional implementation?
The current Interceptor implementation uses a Decorator approach,
where
each
Interceptor invokes itself the next one.
Another strategy is the one defined by the servlet specifications 2.3:
the
general idea is to add two new components, namely an "Interceptor
Manager"
and an "Ordered list of Interceptors".
In such an implementation the "Interceptor Manager",
InterceptorManager,
manages the "Ordered list of Interceptors", InterceptorChain, and
each
Interceptor invokes InterceptorChain instead of invoking directly the
next
Interceptor.
At the end of the day, for a stack of two Interceptors, iter1 and
iter2,
the
flow is:
InterceptorChain -> iter1 -> InterceptorChain -> iter2 ->
InterceptorChain
I think that such an implementation is sometime more powerful: it
allows
to
have rather simply the number of Interceptors, to add/remove at any
given
position an Interceptor. For instance, to add a new Interceptor right
in
the
middle of two other ones, one could request to InterceptorManager to
insert
a "Latch Interceptor" as the head of the InterceptorChain. This "Latch
Interceptor" simply blocks the incoming invocations the time required
to
insert the new Interceptor. When this is done, InterceptorManager
removes
the "Latch Interceptor" and releases the latch.
Cheers,
Gianny
_________________________________________________________________
Trouvez l'�me soeur sur MSN Rencontres http://g.msn.fr/FR1000/9551