You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Dain Sundstrom <da...@coredevelopers.net> on 2003/08/24 07:18:33 UTC

Re: cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/lock LockInterceptor.java

On Saturday, August 23, 2003, at 05:09 PM, jboynes@apache.org wrote:

>        public final void addInterceptor(Interceptor interceptor) {
>   -        if (getStateInstance() != State.STOPPED) {
>   -            throw new IllegalStateException("Interceptors cannot be 
> added unless the Container is stopped");
>   +        if (getStateInstance() == State.RUNNING) {
>   +            throw new IllegalStateException("Interceptors cannot be 
> added if the Container is running");
>            }

You shouldn't be able to modify the interceptor stack while the 
container is stopping state either.  A container may want to allow 
invocations in while stopping to unwind current work.

/*************************
  * Dain Sundstrom
  * Partner
  * Core Developers Network
  *************************/


RE: cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/lock LockInterceptor.java

Posted by Jeremy Boynes <je...@coredevelopers.net>.
> From: Dain Sundstrom [mailto:dain@coredevelopers.net] 
> On Saturday, August 23, 2003, at 05:09 PM, jboynes@apache.org wrote:
> 
> >        public final void addInterceptor(Interceptor interceptor) {
> >   -        if (getStateInstance() != State.STOPPED) {
> >   -            throw new 
> IllegalStateException("Interceptors cannot be 
> > added unless the Container is stopped");
> >   +        if (getStateInstance() == State.RUNNING) {
> >   +            throw new 
> IllegalStateException("Interceptors cannot be 
> > added if the Container is running");
> >            }
> 
> You shouldn't be able to modify the interceptor stack while the 
> container is stopping state either.  A container may want to allow 
> invocations in while stopping to unwind current work.
> 

If I am building the stack in doStart(), then I would be clearing it in
doStop() when the state is STOPPING. 

Also, the (final) invoke method prevents any invocations from starting
in the STOPPING state, so the only race condition I see is if the
container tweaked the chain during stop, which it doesn't - it just
drops its reference to it so the stack will die (become eligible for GC)
when the last inflight invocation exits.

--
Jeremy