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 2020/04/02 13:48:41 UTC

[tomcat] branch 9.0.x updated: Added extension point for custom delta requests

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 40a5f17  Added extension point for custom delta requests
40a5f17 is described below

commit 40a5f176f2918d46084d7cceb7ecb27e933e8701
Author: Thomas Stock <ts...@novomind.com>
AuthorDate: Thu Feb 13 12:55:32 2020 +0100

    Added extension point for custom delta requests
---
 .../apache/catalina/ha/session/DeltaSession.java    | 21 +++++++++++++++++----
 webapps/docs/changelog.xml                          |  9 +++++++++
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/ha/session/DeltaSession.java b/java/org/apache/catalina/ha/session/DeltaSession.java
index 2465c60..201cce8 100644
--- a/java/org/apache/catalina/ha/session/DeltaSession.java
+++ b/java/org/apache/catalina/ha/session/DeltaSession.java
@@ -106,7 +106,20 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
         super(manager);
         boolean recordAllActions = manager instanceof ClusterManagerBase &&
                 ((ClusterManagerBase)manager).isRecordAllActions();
-        deltaRequest = new DeltaRequest(getIdInternal(), recordAllActions);
+        deltaRequest = createRequest(getIdInternal(), recordAllActions);
+    }
+
+    private DeltaRequest createRequest() {
+        return createRequest(null, false);
+    }
+
+    /*
+     * DeltaRequest instances are created via this protected method to enable
+     * sub-classes to over-ride the method to use custom DeltaRequest
+     * implementations.
+     */
+    protected DeltaRequest createRequest(String sessionId, boolean recordAllActions) {
+        return new DeltaRequest(sessionId, recordAllActions);
     }
 
     // ----------------------------------------------------- ReplicatedMapEntry
@@ -145,10 +158,10 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
             deltaRequestPool = ((ClusterManagerBase) manager).getDeltaRequestPool();
             newDeltaRequest = deltaRequestPool.pop();
             if (newDeltaRequest == null) {
-                newDeltaRequest = new DeltaRequest(null, ((ClusterManagerBase) manager).isRecordAllActions());
+                newDeltaRequest = createRequest(null, ((ClusterManagerBase) manager).isRecordAllActions());
             }
         } else {
-            newDeltaRequest = new DeltaRequest();
+            newDeltaRequest = createRequest();
         }
 
         DeltaRequest oldDeltaRequest = replaceDeltaRequest(newDeltaRequest);
@@ -679,7 +692,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
             DeltaRequest newDeltaRequest = deltaRequestPool.pop();
             if (newDeltaRequest == null) {
-                newDeltaRequest = new DeltaRequest(null, ((ClusterManagerBase) manager).isRecordAllActions());
+                newDeltaRequest = createRequest(null, ((ClusterManagerBase) manager).isRecordAllActions());
             }
 
             ReplicationStream ois = ((ClusterManagerBase) manager).getReplicationStream(delta);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 00f5eb8..e0a6bfe 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -127,6 +127,15 @@
       </add>
     </changelog>
   </subsection>
+  <subsection name="Cluster">
+    <changelog>
+      <scode>
+        Refactor the creation of <code>DeltaRequest</code> objects to make it
+        simpler to use custom implementations. Based on a pull request provided
+        by Thomas Stock. (markt)
+      </scode>
+    </changelog>
+  </subsection>
   <subsection name="Web applications">
     <changelog>
       <fix>


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