Package org.xmlBlaster.util.queue

Examples of org.xmlBlaster.util.queue.I_EntryFilter


         boolean checkForDuplicateSubscriptions = this.global.getProperty().get("xmlBlaster/checkForDuplicateSubscriptions", false);
         if (checkForDuplicateSubscriptions) {
            duplicateCounter = 0;
            errorCounter = 0;
            final java.util.Map duplicates = new java.util.TreeMap();
            /*I_MapEntry[] results = */this.subscribeStore.getAll(new I_EntryFilter() {
               public I_Entry intercept(I_Entry entry, I_Storage storage) {
                  if (storage.isTransient()) return null;
                  try {
                     SubscribeEntry subscribeEntry = (SubscribeEntry)entry;
                     //QueryKeyData keyData = queryKeyFactory.readObject(subscribeEntry.getKey());
View Full Code Here


         if (manager != null) {
            try {
               String queueNamePattern = Constants.RELATING_CALLBACK + "%";
               String flag = ServerEntryFactory.ENTRY_TYPE_UPDATE_REF; // "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;
                           //final long refId = callbackEntry.getMsgUnitWrapperUniqueId();
View Full Code Here

         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;
                                       final long refId = callbackEntry.getMsgUnitWrapperUniqueId();
                                       if (refId == currMsgUnitId)
                                          foundInCallbackQueue.put(currMsgUnitIdL, callbackEntry);
                                       //else
                                       //   notFoundInCallbackQueue.put(currMsgUnitIdL, entry);
                                    }
                                    else {
                                       // todo
                                    }
                                    return null; // Filter away so getAll returns nothing
                                 }
                                 catch (Throwable e) {
                                    log.warning("Ignoring during callback queue processing exception: " + e.toString());
                                    return null; // Filter away so getAll returns nothing
                                 }
                              }
                           });
                           if (before == (foundInCallbackQueue.size() + notFoundInCallbackQueue.size())) // no hit
                              notFoundInCallbackQueue.put(currMsgUnitIdL, entry);

                        }
                        catch (Throwable e) {
                           log.severe("Raw access to database failed: " + e.toString());
                        }
                     }
                     else {
                        log.warning("Raw access to database is not possible");
                     }

                     if (manager == null) { // fallback if raw access failed
                        // Process the callback queue of each loaded client (we won't find transient clients with positive session id and not yet re-connected)
                        SessionInfo[] arr = authenticate.getSessionInfoArr();
                        for (int i=0; i<arr.length; i++) {
                           SessionInfo sessionInfo = arr[i];
                           I_Queue callbackQueue = sessionInfo.getSessionQueue();
                           if (callbackQueue != null) {
                              callbackQueue.getEntries(new I_EntryFilter() {
                                 public I_Entry intercept(I_Entry ent, I_Storage storage) {
                                    try {
                                       ReferenceEntry callbackEntry = (ReferenceEntry)ent;
                                       final long refId = callbackEntry.getMsgUnitWrapperUniqueId();
                                       if (refId == currMsgUnitId)
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.queue.I_EntryFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.