• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

listener notification order / HFSJ CH5#11 doubt

 
Mike Mitchell
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • 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
 
Ankit Garg
Sheriff
Posts: 9577
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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 ...
 
Bindu Lakhanpal
Ranch Hand
Posts: 171
Flex Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also interested to know its answer.
Thanks Mike for asking.

 
Viswanath Tg
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic