Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Listener registering and invocation order

 
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
 
Sheriff
Posts: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • 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?
 
Ranch Hand
Posts: 814
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
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic