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