Package org.xmlBlaster.util.qos.storage

Examples of org.xmlBlaster.util.qos.storage.MsgUnitStoreProperty


         assertEquals("", true, topicProperty.isReadonly());
         assertEquals("", 120000, topicProperty.getDestroyDelay());
         assertEquals("", true, topicProperty.createDomEntry());

         assertEquals("", true, topicProperty.hasMsgUnitStoreProperty());
         MsgUnitStoreProperty cache = topicProperty.getMsgUnitStoreProperty();
         assertEquals("", "msgUnitStore", cache.getRelating());
         assertEquals("", "TO", cache.getType());
         assertEquals("", "3.0", cache.getVersion());
         assertEquals("", 4L, cache.getMaxEntries());
         assertEquals("", 40L, cache.getMaxBytes());
         assertEquals("", "deadMessage", cache.getOnOverflow());

         assertEquals("", true, topicProperty.hasHistoryQueueProperty());
         HistoryQueueProperty hist = topicProperty.getHistoryQueueProperty();
         assertEquals("", "history", hist.getRelating());
         assertEquals("", "HI", hist.getType());
View Full Code Here


   /**
    * @return the configuration of the message store, is never null
    */
   public MsgUnitStoreProperty getMsgUnitStoreProperty() {
      if (this.msgUnitStoreProperty == null) {
         this.msgUnitStoreProperty = new MsgUnitStoreProperty(glob, glob.getStrippedId());
      }
      return this.msgUnitStoreProperty;
   }
View Full Code Here

            // as some line below getAll() gets all of them!
            this.topicStore = glob.getStoragePluginManager().getPlugin(type, version, topicStoreId, topicStoreProperty);
            //this.topicStore = new org.xmlBlaster.engine.msgstore.ram.MapPlugin();
            log.info("Activated storage '" + this.topicStore.getStorageId() + "' for persistent topics, found " + this.topicStore.getNumOfEntries() + " topics to recover.");

            MsgUnitStoreProperty limitM = new MsgUnitStoreProperty(glob, null); // The current limit from xmlBlaster.properties
            HistoryQueueProperty limitH = new HistoryQueueProperty(glob, null); // The current limit
            I_MapEntry[] mapEntryArr = this.topicStore.getAll(null);
            boolean fromPersistenceStore = true;
            for(int i=0; i<mapEntryArr.length; i++) {
               TopicEntry topicEntry = (TopicEntry)mapEntryArr[i];
               PublishQosServer publishQosServer = new PublishQosServer(glob,
                       (MsgQosData)topicEntry.getMsgUnit().getQosData(), fromPersistenceStore);
               publishQosServer.setTopicEntry(topicEntry); // Misuse PublishQosServer to transport the topicEntry
               boolean existsAlready = (glob.getTopicAccessor().accessDirtyRead(topicEntry.getKeyOid()) != null);
               if (existsAlready) {
                  log.warning("Removing duplicate of topic '" + topicEntry.getLogId() + "' from persistence store");
                  try {
                     this.topicStore.remove(topicEntry);
                  }
                  catch (XmlBlasterException e) {
                     log.severe("Removing duplicate of topic '" + topicEntry.getLogId() + "' from persistence store makes problems: " + e.getMessage());
                  }
                  continue;
               }
               try {
                  // Check limits
                  TopicProperty topicProps = ((MsgQosData)topicEntry.getMsgUnit().getQosData()).getTopicProperty();
                  if (topicProps != null && topicProps.getMsgUnitStoreProperty() != null) {
                     MsgUnitStoreProperty p = topicProps.getMsgUnitStoreProperty();
                     if (p.getMaxBytes() > limitM.getMaxBytes()) { // How to prevent a smaller limit than actual bytes on HD?
                        p.setMaxBytes(limitM.getMaxBytes());
                     }
                     if (p.getMaxBytesCache() > limitM.getMaxBytesCache()) {
                        p.setMaxBytesCache(limitM.getMaxBytesCache());
                     }
                     if (p.getMaxEntries() > limitM.getMaxEntries()) { // How to prevent a smaller limit than actual entries on HD?
                        p.setMaxEntries(limitM.getMaxEntries());
                     }
                     if (p.getMaxEntriesCache() > limitM.getMaxEntriesCache()) {
                        p.setMaxEntriesCache(limitM.getMaxEntriesCache());
                     }
                  }

                  if (topicProps != null && topicProps.getHistoryQueueProperty() != null) {
                     HistoryQueueProperty h = topicProps.getHistoryQueueProperty();
View Full Code Here

               out.write(("\n <TopicHandler id='"+topicHandler.getUniqueKey()+"'><topic>").getBytes("UTF-8"));
               I_Map m = topicHandler.getMsgUnitCache();
               if (m != null) {
                 PersistenceCachePlugin c = null;
                 if (m instanceof PersistenceCachePlugin) c = (PersistenceCachePlugin)m;
                 MsgUnitStoreProperty p = (MsgUnitStoreProperty)m.getProperties();
                 long bc = (c != null) ? c.getNumOfCachedBytes() : 0;
                 long ec = (c != null) ? c.getNumOfCachedEntries() : 0;
                 out.write(("\n   <persistence relating='msgUnitStore' entries='"+m.getNumOfEntries()
                       +"' entriesCache='"+ec+"' bytes='"+m.getNumOfBytes()+"' bytesCache='"+bc+"'/>").getBytes("UTF-8"));
                 out.write(p.toXml("  ").getBytes("UTF-8"));
                 out.write(("\n </topic></TopicHandler>").getBytes("UTF-8"));
                 currentBytes += m.getNumOfBytes();
                 currentBytesCache += bc;
                 currentEntries += m.getNumOfEntries();
                 currentEntriesCache += ec;
                 currentMaxBytes += p.getMaxBytes();
                 currentMaxBytesCache += p.getMaxBytesCache();
                 currentMaxEntries += p.getMaxEntries();
                 currentMaxEntriesCache += p.getMaxEntriesCache();
               }
               else {
                 out.write(("\n   <persistence relating='msgUnitStore'>null</persistence>").getBytes("UTF-8"));
                 out.write(("\n </topic></TopicHandler>").getBytes("UTF-8"));
               }
View Full Code Here

               if (relatedVal == null)
                  relatedVal = Constants.RELATING_MSGUNITSTORE;

               relatedVal = relatedVal.trim();
               if (Constants.RELATING_MSGUNITSTORE.equalsIgnoreCase(relatedVal)) {   // <queue related='msgUnitStore' is deprecated here! (is parsed now as msgUnitStore, see below)
                  MsgUnitStoreProperty tmpProp = new MsgUnitStoreProperty(glob, glob.getId());
                  tmpProp.startElement(uri, localName, name, attrs);
                  msgQosData.getTopicProperty().setMsgUnitStoreProperty(tmpProp);
               }
               else { // assuming related="history"
                  HistoryQueueProperty tmpProp = new HistoryQueueProperty(glob, glob.getId());
                  tmpProp.startElement(uri, localName, name, attrs);
                  msgQosData.getTopicProperty().setHistoryQueueProperty(tmpProp);
               }
               return;
            }

            log.warning("Found queue tag but don't know how to handle it: " + xmlLiteral);
         }
         return;
      }

      if (name.equalsIgnoreCase("persistence")) {
         if (!inQos)
            return;
//       this.inPersistence = true;
         if (attrs != null) {
            if (inTopic) {
               MsgUnitStoreProperty tmpProp = new MsgUnitStoreProperty(glob, glob.getId());
               tmpProp.startElement(uri, localName, name, attrs);
               msgQosData.getTopicProperty().setMsgUnitStoreProperty(tmpProp);
               return;
            }

            log.warning("Found msgUnitStore tag but don't know how to handle it: " + xmlLiteral);
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.qos.storage.MsgUnitStoreProperty

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.