You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/07/28 17:04:15 UTC
[activemq-artemis] branch main updated: ARTEMIS-3909 Move RoutingContext::processReferences as a static method in PostOffice
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new e44bd5266f ARTEMIS-3909 Move RoutingContext::processReferences as a static method in PostOffice
e44bd5266f is described below
commit e44bd5266f0bc526be6ff6ec266050bb6f71dea0
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Thu Jul 28 12:16:34 2022 -0400
ARTEMIS-3909 Move RoutingContext::processReferences as a static method in PostOffice
We were lucky that processReferences was pretty much a static operation, hence I am moving it away from RoutingContext both for clarity and avoiding state being needed on that method.
If state was needed as part of processReferences you would had a pretty nasty bug as the IOCallback could introduce a race where a send would change the state while the IO was pending.
---
.../artemis/core/postoffice/impl/PostOfficeImpl.java | 8 +++++++-
.../apache/activemq/artemis/core/server/RoutingContext.java | 2 --
.../artemis/core/server/impl/RoutingContextImpl.java | 12 ------------
3 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
index 6f37ea3fa3..6beb348023 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
@@ -1592,12 +1592,18 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
@Override
public void done() {
- context.processReferences(refs, direct);
+ processReferences(refs, direct);
}
});
}
}
+ private static void processReferences(List<MessageReference> refs, boolean direct) {
+ for (MessageReference ref : refs) {
+ ref.getQueue().addTail(ref, direct);
+ }
+ }
+
private void processRouteToDurableQueues(final Message message,
final RoutingContext context,
final Long deliveryTime,
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/RoutingContext.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/RoutingContext.java
index db9c360b38..f6cff3d1be 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/RoutingContext.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/RoutingContext.java
@@ -93,8 +93,6 @@ public interface RoutingContext {
RoutingType getPreviousRoutingType();
- void processReferences(List<MessageReference> refs, boolean direct);
-
boolean isReusable(Message message, int version);
boolean isDuplicateDetection();
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RoutingContextImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RoutingContextImpl.java
index fb0eb7d57e..19c0cf0bd1 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RoutingContextImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RoutingContextImpl.java
@@ -26,7 +26,6 @@ import java.util.concurrent.Executor;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.core.server.MessageReference;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.RouteContextList;
import org.apache.activemq.artemis.core.server.RoutingContext;
@@ -215,17 +214,6 @@ public class RoutingContextImpl implements RoutingContext {
return stringWriter.toString();
}
- @Override
- public void processReferences(final List<MessageReference> refs, final boolean direct) {
- internalprocessReferences(refs, direct);
- }
-
- private void internalprocessReferences(final List<MessageReference> refs, final boolean direct) {
- for (MessageReference ref : refs) {
- ref.getQueue().addTail(ref, direct);
- }
- }
-
@Override
public RoutingContextImpl setLoadBalancingType(MessageLoadBalancingType messageLoadBalancingType) {
this.loadBalancingType = messageLoadBalancingType;