| Author |
Listener registering and invocation order
|
Maciek Mike
Greenhorn
Joined: Feb 03, 2010
Posts: 22
|
|
Hi,
Do you know what is the order of listener registration, is it according to order in web.xml with respect to type of listeners?
In which order they are invoked? I've heard that this order changes when application is about to shut down?
Please help, thanks in advance
|
SCJP 5.0 (94%), SCJD (388/400), SCWCD (97%)
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9023
|
|
From the servlet specs
Servlet Specs wrote:SRV.10.3.3 Listener Registration
TheWeb container creates an instance of each listener class and registers it for event
notifications prior to the processing of the first request by the application. The Web
container registers the listener instances according to the interfaces they implement
and the order in which they appear in the deployment descriptor. During Web
application execution, listeners are invoked in the order of their registration.
SRV.10.3.4 Notifications At Shutdown
On application shutdown, listeners are notified in reverse order to their declarations
with notifications to session listeners preceeding notifications to context listeners.
Session listeners must be notified of session invalidations prior to context listeners
being notified of application shutdown.
|
Javaranch SCJP FAQ | SCWCD Links
|
 |
Maciek Mike
Greenhorn
Joined: Feb 03, 2010
Posts: 22
|
|
Thanks, now I'm wondering what does
The Web
container registers the listener instances according to the interfaces they implement
and the order in which they appear in the deployment descriptor.
really mean? Which interfaces are first? Maybe it is vendor-specific?
|
 |
Ninad Kulkarni
Ranch Hand
Joined: Aug 31, 2007
Posts: 754
|
|
@ Maciek
Read SRV.10.2.1 from servlet specification 2.4 final release
|
SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
|
 |
 |
|
|
subject: Listener registering and invocation order
|
|
|