Commit 20d4820d authored by Christian Schudt's avatar Christian Schudt

OF-818 Move isEmpty() check before filtering for highest prio sessions

parent 007dd25e
...@@ -528,6 +528,12 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust ...@@ -528,6 +528,12 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust
// Get the sessions with non-negative priority for message carbons processing. // Get the sessions with non-negative priority for message carbons processing.
List<ClientSession> nonNegativePrioritySessions = getNonNegativeSessions(sessions, 0); List<ClientSession> nonNegativePrioritySessions = getNonNegativeSessions(sessions, 0);
if (nonNegativePrioritySessions.isEmpty()) {
// No session is available so store offline
Log.debug("Unable to route packet. No session is available so store offline. {} ", packet.toXML());
return false;
}
// Get the highest priority sessions for normal processing. // Get the highest priority sessions for normal processing.
List<ClientSession> highestPrioritySessions = getHighestPrioritySessions(nonNegativePrioritySessions); List<ClientSession> highestPrioritySessions = getHighestPrioritySessions(nonNegativePrioritySessions);
...@@ -539,12 +545,7 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust ...@@ -539,12 +545,7 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust
} }
} }
if (highestPrioritySessions.isEmpty()) { if (highestPrioritySessions.size() == 1) {
// No session is available so store offline
Log.debug("Unable to route packet. No session is available so store offline. {} ", packet.toXML());
return false;
}
else if (highestPrioritySessions.size() == 1) {
// Found only one session so deliver message (if it hasn't already been processed because it has message carbons enabled) // Found only one session so deliver message (if it hasn't already been processed because it has message carbons enabled)
if (!shouldCarbonCopyToResource(highestPrioritySessions.get(0), packet, isPrivate)) { if (!shouldCarbonCopyToResource(highestPrioritySessions.get(0), packet, isPrivate)) {
highestPrioritySessions.get(0).process(packet); highestPrioritySessions.get(0).process(packet);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment