log.warning("got " + pushEntries.size() + " entries in Dispatcher Sync mode (happens on communication Exceptions. Will ignore this");
// return pushEntries;
return null;
}
I_ReplSlave slave = null;
String relativeName = dispatchManager.getSessionName().getRelativeName();
int maxEntriesToRetrieve = this.maxNumOfEntries;
synchronized (this.replSlaveMap) {
slave = (I_ReplSlave)this.replSlaveMap.get(relativeName);
int status = slave.getStatusAsInt();
if (status != I_ReplSlave.STATUS_NORMAL && status != I_ReplSlave.STATUS_INCONSISTENT) {
log.info("Setting the number of entries to retreive to '1' since status is '" + slave.getStatus() + "' (otherwise it would be '" + this.maxNumOfEntries + "'");
maxEntriesToRetrieve = 1;
}
else
maxEntriesToRetrieve = getMaxNumOfEntries(slave);
}
// take messages from queue (none blocking) ...
I_Queue cbQueue = dispatchManager.getQueue();
// ArrayList entryList = cbQueue.peekSamePriority(-1, this.maxSize);
List<I_Entry> entryList = cbQueue.peekSamePriority(maxEntriesToRetrieve, this.maxSize);
log.info("handleNextMessages invoked with '" + entryList.size() + "' entries (max was '" + maxEntriesToRetrieve + "'");
// filter expired entries etc. ...
// you should always call this method after taking messages from queue
entryList = dispatchManager.prepareMsgsFromQueue(entryList);
log.info("handleNextMessages after cleaning up with '" + entryList.size() + "' entries");
if (slave == null) {
log.warning("could not find a slave for replication client '" + relativeName + "'");
return entryList;
}
try {
return slave.check(entryList, cbQueue);
}
catch (Exception ex) {
if (slave != null)
slave.handleException(ex);
if (ex instanceof XmlBlasterException)
throw (XmlBlasterException)ex;
throw new XmlBlasterException(this.global, ErrorCode.INTERNAL, "exception occured when filtering replication messages", "", ex);
}
catch (Throwable ex) {
if (slave != null)
slave.handleException(ex);
throw new XmlBlasterException(this.global, ErrorCode.INTERNAL, "throwable occured when filtering replication messages. " + Global.getStackTraceAsString(ex), "", ex);
}
}