• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Listener

 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
If I have 2 listerer which implements ServletContextListener, MyListener1 and MyListener2.
I configure in web.xml like this:
<listener>
<listener-class>MyListener1</listener-class>
</listener>
<listener>
<listener-class>MyListener2</listener-class>
</listener>
When I shutdown the application, which of two my listener will be called first? MyListener1 or MyListener2?
thanks
daniel
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The MyListener1 will be called ... and it will be called first ... !!!
Not sure if container will still look out for MyListener2 !!!
 
Arvind Chavar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlet Container should call both the listeners, and they will be called in the order they have been defined in deployment descriptor.
You could write simple code to confirm this.Do log some statements in each o fthe listeners and check the server log.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic