• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

listener notification order / HFSJ CH5#11 doubt

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy Ranchers,

I have a question about listener notification order I'm hoping you can help me with. The answer to the following question (HFSJ CH5#11) is given as C, as listener order is determined by the order in which they're declared in the deployment descriptor, and B we're told is wrong because 'the container uses the DD to determine the notification order of registered listeners.' But what about binding listeners, which (per p183) are not registered in the DD? For example, if I have an object that implements HttpSessionBindingListener, and I bind it to a session, is it predictable whether the object bound will be notified before or after an HttpSessionAttribute listener? I did a test (on Tomcat 5.5) and found that the object's valueBound() fired before my HttpSessionAttributeListener, but I wonder if that's guaranteed to be the case from container to container (or from certification test to certification test :-)).

Which are true? (Choose all that apply.)
A. When a web application is preparing to shutdown, the order of listener notification is not guaranteed.
B. When listener-friendly events occur, listener invocation order is not predictable.
C. The container registers listeners based on declarations in the deployment descriptor.
D. Only the container can invalidate a session.

Thanks,
Mike
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I couldn't find anything regarding this in the servlet spec. Maybe its container dependent. BTW since it is not given in the HFSJ book, I think it will not be asked on the exam ...
 
Ranch Hand
Posts: 171
Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am also interested to know its answer.
Thanks Mike for asking.

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to my understanding ::
In web based application listeners will be loaded, on application start up
listener is called when the user does something to the user interface that causes an event. Altho these events usually come from the user interface, they can have other sources ex:Session Binding Listener

 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic