Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Listener registering and invocation order

 
Maciek Mike
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ankit Garg
Sheriff
Posts: 9580
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Maciek Mike
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 802
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ Maciek
Read SRV.10.2.1 from servlet specification 2.4 final release
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic