You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/06/28 21:32:40 UTC

svn commit: r1140801 - in /tomcat/trunk: java/org/apache/catalina/ha/session/DeltaManager.java webapps/docs/changelog.xml

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);
         }
     }
 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1140801&r1=1140800&r2=1140801&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Jun 28 19:32:39 2011
@@ -217,6 +217,11 @@
         <bug>51306</bug>: Avoid NPE when handleSESSION_EXPIRED is processed 
         while handleSESSION_CREATED is being processed. (kfujino)
       </fix>
+      <fix>
+        Notifications of changes in session ID to other nodes in the cluster
+        should be controlled by notifySessionListenersOnReplication rather than
+        notifyListenersOnReplication. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Web applications">



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


Re: svn commit: r1140801 - in /tomcat/trunk: java/org/apache/catalina/ha/session/DeltaManager.java webapps/docs/changelog.xml

Posted by Keiichi Fujino <kf...@apache.org>.
Thanks for the comment.
I committed it with r1141441.

2011/6/29 Mark Thomas <ma...@apache.org>:
> On 29/06/2011 11:36, Keiichi Fujino wrote:
>> 2011/6/29  <ma...@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.
>
> <snip/>
>
>> 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?
>
> I think you are right. The session event should not be fired on primary
> or backup nodes but the container event should be fired on the primary
> and optionally on the backup.
>
>> 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;
>
> Maybe call this notifyContainerListenersOnReplication to allow for
> possible re-use for other events (not that I can think of any right now).
>
> Mark
>
>>      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});
>> +            }
>>          }
>>      }
>>
>>
>> ===
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>



-- 
Keiichi.Fujino

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


Re: svn commit: r1140801 - in /tomcat/trunk: java/org/apache/catalina/ha/session/DeltaManager.java webapps/docs/changelog.xml

Posted by Mark Thomas <ma...@apache.org>.
On 29/06/2011 11:36, Keiichi Fujino wrote:
> 2011/6/29  <ma...@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.

<snip/>

> 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?

I think you are right. The session event should not be fired on primary
or backup nodes but the container event should be fired on the primary
and optionally on the backup.

> 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;

Maybe call this notifyContainerListenersOnReplication to allow for
possible re-use for other events (not that I can think of any right now).

Mark

>      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});
> +            }
>          }
>      }
> 
> 
> ===
> 
> 




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


Re: svn commit: r1140801 - in /tomcat/trunk: java/org/apache/catalina/ha/session/DeltaManager.java webapps/docs/changelog.xml

Posted by Keiichi Fujino <kf...@apache.org>.
2011/6/29  <ma...@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