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:49:14 UTC
[tomcat] branch 8.5.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 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new d3dc830 Added extension point for custom delta requests
d3dc830 is described below
commit d3dc83083ae312c5fea22012b7dd46ca48515154
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 0245bd2..61483dc 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -120,6 +120,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