SubscriptionInfo[] subInfoArr = (SubscriptionInfo[])subInfoList.toArray(new SubscriptionInfo[subInfoList.size()]);
for (int ii=0; ii<subInfoArr.length; ii++) {
SubscriptionInfo sub = subInfoArr[ii];
if (TopicHandler.isDirtyRead(sub, msgUnitWrapper)) {
log.severe("ConsumableQueuePlugin used together with 'dirtyRead' is not supported");
TopicHandler topicHandler = this.serverScope.getTopicAccessor().access(this.topicId);
if (topicHandler == null) return true;
try {
I_Queue srcQueue = topicHandler.getHistoryQueue();
if (srcQueue != null) srcQueue.removeRandom(entry);
}
finally {
this.serverScope.getTopicAccessor().release(topicHandler);
}
return true; // even if it has not been sent
}
}
for (int ii=0; ii<subInfoArr.length; ii++) {
SubscriptionInfo sub = subInfoArr[ii];
if (!TopicHandler.subscriberMayReceiveIt(sub, msgUnitWrapper)) continue;
//Has no effect:
//if (!this.topicHandler.checkIfAllowedToSend(null, sub)) continue;
// this is specific for this plugin
if (sub.getSessionInfo().getDispatchManager() == null) continue;
if (!sub.getSessionInfo().getDispatchManager().getDispatchConnectionsHandler().isAlive()) continue;
try {
try {
TopicHandler topicHandler = this.serverScope.getTopicAccessor().access(this.topicId);
if (topicHandler == null) return true;
try {
// the 'false' here is to tell the filter not to send a dead letter in case of an ex
if (!topicHandler.checkFilter(null, sub, msgUnitWrapper, false)) continue;
}
finally {
this.serverScope.getTopicAccessor().release(topicHandler);
}
}
catch (XmlBlasterException ex) {
// continue;
givingUpDistribution(sub, msgUnitWrapper, entry, ex);
return true; // because the entry has been removed from the history queue
}
// put the current dispatcher at the end of the list for next invocation (round robin)
subInfoList.remove(sub);
subInfoList.add(sub);
MsgQueueUpdateEntry updateEntry = TopicHandler.createEntryFromWrapper(msgUnitWrapper,sub);
UpdateReturnQosServer retQos = doDistribute(sub, updateEntry);
if (log.isLoggable(Level.FINE)) {
if (retQos == null) log.fine("distributeOneEntry: the return object was null: callback has not sent the message (dirty reads ?)");
}
if (retQos == null || retQos.getException() == null) {
TopicHandler topicHandler = this.serverScope.getTopicAccessor().access(this.topicId);
if (topicHandler == null) return true;
try {
I_Queue srcQueue = topicHandler.getHistoryQueue();
if (srcQueue != null) srcQueue.removeRandom(entry); // success
}
finally {
this.serverScope.getTopicAccessor().release(topicHandler);
}