tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keiichi Fujino <kfuj...@apache.org>
Subject Re: svn commit: r1140801 - in /tomcat/trunk: java/org/apache/catalina/ha/session/DeltaManager.java webapps/docs/changelog.xml
Date Wed, 29 Jun 2011 10:36:41 GMT
2011/6/29  <markt@apache.org>:
> Author: markt
> Date: Tue Jun 28 19:32:39 2011
> New Revision: 1140801
>
> URL: http://svn.apache.org/viewvc?rev=1140801&view=rev
> Log:
> Notifications of changes in session ID to other nodes in the cluster should be controlled
by notifySessionListenersOnReplication rather than notifyListenersOnReplication.
>
> Modified:
>    tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
>    tomcat/trunk/webapps/docs/changelog.xml
>
> Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java?rev=1140801&r1=1140800&r2=1140801&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java Tue Jun 28 19:32:39
2011
> @@ -1463,7 +1463,7 @@ public CatalinaCluster getCluster() {
>         if (session != null) {
>             String newSessionID = deserializeSessionId(msg.getSession());
>             session.setPrimarySession(false);
> -            session.setId(newSessionID, notifyListenersOnReplication);
> +            session.setId(newSessionID, notifySessionListenersOnReplication);
>         }
>     }
>
>

A primary node never trigger a notification to any session listeners.
It notifies container event listener now.
Should non-primary node be same behavior as a primary node?

If it notifies not session listener but container event listener,
I will add some changes below.

Comments?

===
Index: java/org/apache/catalina/ha/session/DeltaManager.java
===================================================================
--- java/org/apache/catalina/ha/session/DeltaManager.java	(revision 1140984)
+++ java/org/apache/catalina/ha/session/DeltaManager.java	(working copy)
@@ -97,6 +97,7 @@
     private boolean expireSessionsOnShutdown = false;
     private boolean notifyListenersOnReplication = true;
     private boolean notifySessionListenersOnReplication = true;
+    private boolean notifyChangeSessionIDEventOnReplication = true;
     private volatile boolean stateTransfered = false ;
     private int stateTransferTimeout = 60;
     private boolean sendAllSessions = true;
@@ -420,6 +421,14 @@
         this.notifyListenersOnReplication = notifyListenersOnReplication;
     }

+    public boolean isNotifyChangeSessionIDEventOnReplication() {
+        return notifyChangeSessionIDEventOnReplication;
+    }
+
+    public void setNotifyChangeSessionIDEventOnReplication(
+            boolean notifyChangeSessionIDEventOnReplication) {
+        this.notifyChangeSessionIDEventOnReplication =
notifyChangeSessionIDEventOnReplication;
+    }

    @Override
 public CatalinaCluster getCluster() {
@@ -1463,7 +1472,11 @@
         if (session != null) {
             String newSessionID = deserializeSessionId(msg.getSession());
             session.setPrimarySession(false);
-            session.setId(newSessionID, notifySessionListenersOnReplication);
+            session.setId(newSessionID, false);
+            if (notifyChangeSessionIDEventOnReplication) {
+
getContainer().fireContainerEvent(Context.CHANGE_SESSION_ID_EVENT,
+                        new String[] {msg.getSessionID(), newSessionID});
+            }
         }
     }


===


-- 
Keiichi.Fujino

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message