Hi Folks,


more on the whole InstanceListener thing.

First the good news - Inserting a DefaultContext at the Engine or Host level
allows each
Context that doesn't define the override attribute to successfully pick up
the InstanceListener defined
in the DefaultContext.

I'm assuming that the only syntax for multiple InstanceListeners is as
follows:

<InstanceListener>
  my.instance.listener1
</InstanceListener>

Please tell me if this is a wrong assumption.

And now for something that's confusing me!
I've written a simple instance listener that simply outputs which event it's
either before or after
and I get the following output:

        beforeFilter received for app '/examples'
        beforeFilter received for app '/examples'
        beforeService received for app '/examples'
        beforeInit received for app '/examples'
        afterInit received for app '/examples'
        afterService received for app '/examples'
        afterFilter received for app '/examples'
        afterFilter received for app '/examples'
        beforeService received for app '/examples'
        afterService received for app '/examples'
        beforeService received for app '/examples'
        afterService received for app '/examples'
        beforeService received for app '/examples'
        afterService received for app '/examples'
        beforeService received for app '/examples'
        afterService received for app '/examples'

Why does the 'beforeService' get called before the 'beforeInit'?
Shouldn't an init precede the service event in all cases of a servlet call?
In the above output, \
the init call seems to be nested withing the service call e.g.

        ...
        beforeService
                beforeInit
                afterInit
        afterService
        ...

The before and after events for my servlet also seem to be being called far
more often
that I would expect ie.

for one request why don't I see the following:

beforeFilter
afterFilter (for every filter defined for my app)
beforeInit
afterInit
beforeService
afterService

and, ultimately,

beforeDestroy
afterDestroy

why do I see so many beforeService/afterService calls? - after all,
I'm only invoking my servlet once.

and, if it's some system servlet (like invokerServlet), why don't I see
just as many beforeInit/afterInit calls.

Of course this is all likely due to my lack of understanding of the Servlet
spec (it usually is!)


-Thom

Reply via email to