I decided to skip doing the aforementioned matrix of what's rational and not rational.
The behavior an end user would want depends on what they do in their listener. So,
I've focused on creating an API for a pluggable policy where users can provide an
implementation that tells the clustered session manager exactly what notifications to
emit. Class name of the policy impl to use would be specified in jboss-web.xml. For now
we'd ship two standard impls, one of which provides the existing behavior, one of
which suppresses HttpSessionListener and HttpSessionAttributeListener notifications when a
session is expired due to undeploy.
To have a look at what I've done, see
https://svn.jboss.org/repos/jbossas/branches/Branch_4_2/tomcat/src/main/o...
and the other classes in the same package.
Basically, when an event occurs, before invoking on listeners we ask the policy if
invoking on them is allowed for the given event. We pass as params an enum describing the
type of event, a data object describing the calling node's relationship to the session
(e.g. is it active on this node, or are we just providing backup) and a boolean indicating
whether the event is due to locally originated activity (as opposed to activity
originating on another node.)
Note the class javadoc for ClusteredSessionNotificationPolicy where I emphasize that the
container is not necessarily capable of supporting all the invocations that the policy
might allow. This is critical as it allows me to provide today a policy API where users
can state what they allow, without having at the same time to provide support for
notifications not mandated by the servlet spec. For example, we currently don't issue
HttpSessionListener.sessionCreated() notifications when a session is created on another
node. As more non- spec-mandated notifications are supported, existing policy impls can
appropriately allow/disallow the new notifications.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4176619#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...