Package org.xmlBlaster.util.queue.jdbc

Examples of org.xmlBlaster.util.queue.jdbc.CommonTableDatabaseAccessor


      sf.initialize(this.serverScopeOne);
      String queueCfg = this.serverScopeOne.getProperty().get("QueuePlugin[JDBC][1.0]", (String) null);
      Properties queueProps = parsePropertyValue(queueCfg);
      JdbcConnectionPool pool = new JdbcConnectionPool();
      pool.initialize(this.serverScopeOne, queueProps);
      CommonTableDatabaseAccessor manager = new CommonTableDatabaseAccessor(pool, sf, "dbupdate.OneToThree", null);
      pool.registerStorageProblemListener(manager);
      manager.setUp();
      return manager;
   }
View Full Code Here


      sf.initialize(this.globalOne);
      String queueCfg = this.globalOne.getProperty().get("QueuePlugin[JDBC][1.0]", (String) null);
      Properties queueProps = parsePropertyValue(queueCfg);
      JdbcConnectionPool pool = new JdbcConnectionPool();
      pool.initialize(this.globalOne, queueProps);
      CommonTableDatabaseAccessor manager = new CommonTableDatabaseAccessor(pool, sf, "dbupdate.ClientOneToThree", null);
      pool.registerStorageProblemListener(manager);
      manager.setUp();
      return manager;
   }
View Full Code Here

         prop.put("dbAdmin", "true");

         JdbcConnectionPool pool = new JdbcConnectionPool();
         pool.initialize(this.glob, prop);

         this.manager = new CommonTableDatabaseAccessor(pool, this.glob.getEntryFactory(), pluginInfo.getTypeVersion(), null);
         this.manager.setUp();
         try {
            this.manager.wipeOutDB(false);
         }
         catch (Exception ex) {
View Full Code Here

         // Check no 1: find callback entries with negative session id and no logged in such session
         String queueCfg = this.glob.getProperty().get("QueuePlugin[JDBC][1.0]", (String) null);
         if (queueCfg != null && queueCfg.indexOf("org.xmlBlaster.util.queue.jdbc.JdbcQueue,") != -1)
            return "checkCallbackEntriesConsistency not implemented for new JdbcQueue";

         final CommonTableDatabaseAccessor manager = CommonTableDatabaseAccessor.createInstance(glob, glob.getEntryFactory(), null, null, null);
         final Set leakedEntries = new HashSet();
         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();
                           // TODO: extract if negative sessionId
                           SessionName sessionName = callbackEntry.getReceiver();
                           long publicSessionId = sessionName.getPublicSessionId();
                           if (publicSessionId < 0) {
                              SessionInfo sessionInfo = authenticate.getSessionInfoByName(sessionName);
                              if (sessionInfo == null) {
                                 leakedEntries.add(ent);
                                 out.write(("Found leak entry '" + ent.getLogId() + "' of unknown session " + sessionName.getAbsoluteName() + "\n").getBytes());
                              }
                           }
                        }
                        else {
                           // todo: other checks
                        }
                        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 (fixIt && leakedEntries.size() > 0) {
                  Properties props = new Properties();
                  props.put(Constants.TOXML_FORCEREADABLE, ""+true);
                  log.severe("Removing now "+leakedEntries.size()+" leak entries");
                  Iterator it = leakedEntries.iterator();
                  while (it.hasNext()) {
                     I_Entry entry = (I_Entry)it.next();
                     ReferenceEntry callbackEntry = (ReferenceEntry)entry;
                     try {
                        long num = manager.deleteEntry(callbackEntry.getStorageId().getStrippedId(), entry.getUniqueId());
                        out.write(("\nRemoving " + num + " leaking entry:").getBytes());
                        out.write(("'"+callbackEntry.getStorageId().getStrippedId() + "': " + entry.getLogId()).getBytes());
                        if (num > 0)
                           entry.embeddedObjectToXml(out, props);
                        log.fine("Removing " + num + " leaking entry '"+entry.getLogId()+"'");
View Full Code Here

         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;
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.queue.jdbc.CommonTableDatabaseAccessor

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.