Tomcat 5.5 has an all-to-all replication mechanism, hence all nodes
should be identical. you would only need to see the sessions on one node
to get a picture of what is looks like elsewhere.
there is a flag called "notifyListenersOnReplication" this is only for
attribute replication for nodes that are up in the cluster.
When a "state transfer" is performed, ie, a new node joins the cluster,
then nothing but serialization/deserialization is performed, and no
listeners are called or events fired.
Filip
Vinod Venkatraman wrote:
Hi,
I want to track all the active sessions of a tomcat 5.5 cluster.
Particularly, I want to host a page on each cluster member which will
display all the sessions active on its cluster.
So I want to see a list of :
session-id, user-name, jvmRoute (of member to which this session is sticky
to).
What I have tried is :
Whenever a new session is created I create an object which implements
HttpSessionBindingListener
and put in the session.
public void valueBound(HttpSessionBindingEvent event) {
synchronized(ActiveSessions.ACTIVE_SESSIONS) {
HttpSession session = event.getSession();
ActiveSessions.ACTIVE_SESSIONS.add(this);
System.out.println("VV Registered Session : " + this);
System.out.println("VV Active Sessions count : " +
ActiveSessions.ACTIVE_SESSIONS.size() + " :: Active Sessions : " +
ActiveSessions.ACTIVE_SESSIONS);
}
}
public void valueUnbound(HttpSessionBindingEvent event) {
synchronized(ActiveSessions.ACTIVE_SESSIONS) {
long expiredAt = System.currentTimeMillis();
ActiveSessions.ACTIVE_SESSIONS.remove(this);
// TODO : bookkeeping of expired sessions, write to a separate
log file.
System.out.println("VV Deregistered Session : " + this);
System.out.println("Session Expired : " + this + " Session
lasted from : " + createdAt + "-" + expiredAt);
System.out.println("VV Active Sessions count : " +
ActiveSessions.ACTIVE_SESSIONS.size() + " :: Active Sessions : " +
ActiveSessions.ACTIVE_SESSIONS);
}
}
Things work fine except for following case :
Say clusterMember1 is down when a new session is created at clusterMember2.
When clusterMember1 comes up it syncs it session state with clusterMember2
but valueBound() is
never called in clusterMember1's JVM so I am unable to register this session
in clusterMember1's
ACTIVE_SESSIONS list. Because of this my ACTIVE_SESSIONS list is not in sync
across cluster members.
Is this correct that valueBound will be called on only the cluster members
which were alive when the
object was put in the session ?
Is there any other way I can track all active session of a cluster ?
Thanks,
Vinod
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]