final Map foundInHistoryQueue = new HashMap();
final Map notFoundInHistoryQueue = new HashMap();
final Map foundInCallbackQueue = new HashMap();
final Map notFoundInCallbackQueue = new HashMap();
final CommonTableDatabaseAccessor manager = CommonTableDatabaseAccessor.createInstance(glob, glob.getEntryFactory(), null, null, null);
// Process each msgUnit of this topic
final TopicHandler topicHandler = glob.getTopicAccessor().access(topicOid);
try {
map.getAll(new I_EntryFilter() {
public I_Entry intercept(final I_Entry entry, I_Storage storage) {
try {
final long currMsgUnitId = entry.getUniqueId();
final Long currMsgUnitIdL = new Long(currMsgUnitId);
// Process the history queue of this topic if the messagUnit is referenced
int before = foundInHistoryQueue.size() + notFoundInHistoryQueue.size();
I_Queue historyQueue = topicHandler.getHistoryQueue();
if (historyQueue != null) {
historyQueue.getEntries(new I_EntryFilter() {
public I_Entry intercept(I_Entry ent, I_Storage storage) {
try {
ReferenceEntry historyEntry = (ReferenceEntry)ent;
final long refId = historyEntry.getMsgUnitWrapperUniqueId();
if (refId == currMsgUnitId)
foundInHistoryQueue.put(currMsgUnitIdL, historyEntry);
//else
// notFoundInHistoryQueue.put(currMsgUnitIdL, entry);
return null; // Filter away so getAll returns nothing
}
catch (Throwable e) {
log.warning("Ignoring during history queue processing exception: " + e.toString());
return null; // Filter away so getAll returns nothing
}
}
});
}
if (before == (foundInHistoryQueue.size() + notFoundInHistoryQueue.size())) // no hit
notFoundInHistoryQueue.put(currMsgUnitIdL, entry);
// Raw database access: process all queues used by plugins which also may reference the msgUnitStore
before = foundInCallbackQueue.size() + notFoundInCallbackQueue.size();
if (manager != null) {
try {
// needs tuning as we make a wildcard query for each msgUnit ...
//ArrayList ret = manager.getEntries(StorageId storageId, long[] dataids); // not possible as we need to lookup the referenced dataid
String queueNamePattern = Constants.RELATING_CALLBACK + "%";
String flag = "UPDATE_REF";
manager.getEntriesLike(queueNamePattern, flag, -1, -1,
new I_EntryFilter() {
public I_Entry intercept(I_Entry ent, I_Storage storage) {
try {
if (ent instanceof ReferenceEntry) {
ReferenceEntry callbackEntry = (ReferenceEntry)ent;