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.
This commit is contained in:
parent
1e56f823a5
commit
e44bd5266f
|
@ -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,
|
||||
|
|
|
@ -93,8 +93,6 @@ public interface RoutingContext {
|
|||
|
||||
RoutingType getPreviousRoutingType();
|
||||
|
||||
void processReferences(List<MessageReference> refs, boolean direct);
|
||||
|
||||
boolean isReusable(Message message, int version);
|
||||
|
||||
boolean isDuplicateDetection();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue