tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kfuj...@apache.org
Subject svn commit: r1671470 - in /tomcat/trunk/java/org/apache/catalina/ha/session: DeltaRequest.java DeltaSession.java
Date Mon, 06 Apr 2015 02:34:11 GMT
Author: kfujino
Date: Mon Apr  6 02:34:10 2015
New Revision: 1671470

URL: http://svn.apache.org/r1671470
Log:
Avoid unnecessary call of DeltaRequest#addSessionListener in non-primary nodes.

Modified:
    tomcat/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java
    tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java?rev=1671470&r1=1671469&r2=1671470&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java Mon Apr  6 02:34:10
2015
@@ -204,9 +204,9 @@ public class DeltaRequest implements Ext
                 case TYPE_LISTENER:
                     SessionListener listener = (SessionListener) info.getValue();
                     if (info.getAction() == ACTION_SET) {
-                        session.addSessionListener(listener);
+                        session.addSessionListener(listener,false);
                     } else {
-                        session.removeSessionListener(listener);
+                        session.removeSessionListener(listener,false);
                     }
                     break;
                 default :

Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java?rev=1671470&r1=1671469&r2=1671470&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java Mon Apr  6 02:34:10
2015
@@ -504,10 +504,14 @@ public class DeltaSession extends Standa
 
     @Override
     public void addSessionListener(SessionListener listener) {
+        addSessionListener(listener, true);
+    }
+
+    public void addSessionListener(SessionListener listener, boolean addDeltaRequest) {
         lock();
         try {
             super.addSessionListener(listener);
-            if (deltaRequest != null && listener instanceof ReplicatedSessionListener)
{
+            if (addDeltaRequest && deltaRequest != null && listener instanceof
ReplicatedSessionListener) {
                 deltaRequest.addSessionListener(listener);
             }
         } finally {
@@ -517,10 +521,14 @@ public class DeltaSession extends Standa
 
     @Override
     public void removeSessionListener(SessionListener listener) {
+        removeSessionListener(listener, true);
+    }
+
+    public void removeSessionListener(SessionListener listener, boolean addDeltaRequest)
{
         lock();
         try {
             super.removeSessionListener(listener);
-            if (deltaRequest != null && listener instanceof ReplicatedSessionListener)
{
+            if (addDeltaRequest && deltaRequest != null && listener instanceof
ReplicatedSessionListener) {
                 deltaRequest.removeSessionListener(listener);
             }
         } finally {



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


Mime
View raw message