Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown


Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to head first, there can be any number of classes implementing a listener, and they are called in the order as declared in the DD. But what happens when the application is shutting down? Are they called in the same order or reverse order?

I read somewhere that they are called in the reverse order, but this does not make sense to me. Can someone please explain.
Creator of Enthuware JWS+ V6
Posts: 3348
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kanishka,

It is just mandated by the specs, nothing really to explain :

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.

The moustache of a titan! The ad of a flea:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic