aboutsummaryrefslogtreecommitdiffstats
path: root/messagebus
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-01-25 16:48:26 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2023-01-25 17:05:48 +0100
commit7e8209d06e1b67c3d1f5c05acc8c3f0a19234380 (patch)
treee1d386dd1b9646a302b98781005f6b364b291065 /messagebus
parent9a85de6ca1badd76e04a2315b693a8e512c0d6d1 (diff)
Replace synchronized Stack with Deque in feed and query path.
Diffstat (limited to 'messagebus')
-rwxr-xr-xmessagebus/src/main/java/com/yahoo/messagebus/routing/RoutingNode.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/messagebus/src/main/java/com/yahoo/messagebus/routing/RoutingNode.java b/messagebus/src/main/java/com/yahoo/messagebus/routing/RoutingNode.java
index 1f63744c205..ac8fd637646 100755
--- a/messagebus/src/main/java/com/yahoo/messagebus/routing/RoutingNode.java
+++ b/messagebus/src/main/java/com/yahoo/messagebus/routing/RoutingNode.java
@@ -21,7 +21,6 @@ import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
-import java.util.Stack;
import java.util.concurrent.atomic.AtomicInteger;
/**
@@ -130,7 +129,7 @@ public class RoutingNode implements ReplyHandler {
* @param msg The error message to assign.
*/
private void notifyAbort(String msg) {
- Stack<RoutingNode> stack = new Stack<>();
+ Deque<RoutingNode> stack = new ArrayDeque<>();
stack.push(this);
while (!stack.isEmpty()) {
RoutingNode node = stack.pop();
@@ -430,8 +429,7 @@ public class RoutingNode implements ReplyHandler {
private boolean lookupRoute() {
RoutingTable table = mbus.getRoutingTable(msg.getProtocol());
Hop hop = route.getHop(0);
- if (hop.getDirective(0) instanceof RouteDirective) {
- RouteDirective dir = (RouteDirective)hop.getDirective(0);
+ if (hop.getDirective(0) instanceof RouteDirective dir) {
if (table == null || !table.hasRoute(dir.getName())) {
setError(ErrorCode.ILLEGAL_ROUTE, "Route '" + dir.getName() + "' does not exist.");
return false;