Package org.xmlBlaster.util.qos.storage

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


    * @see I_Map#setProperties(Object)
    */
   public synchronized void setProperties(Object userData) throws XmlBlasterException {
      if (userData == null) return;
      if (log.isLoggable(Level.FINER)) log.finer("Entering setProperties()");
      QueuePropertyBase newProp;
      try {
         newProp = (QueuePropertyBase)userData;
      }
      catch(Throwable e) {
         throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION, ME, "Can't configure queue, your properties are invalid", e);
View Full Code Here


         return getStorageId() + ": No persistence store found, setMax"+loc+"(" + max + ") ignored";

      Object obj = pm.getProperties();
      if (!(obj instanceof QueuePropertyBase))
         return getStorageId() + ": Configuration does not support setMax"+loc+"(" + max + "), ignored request";
      QueuePropertyBase property = (QueuePropertyBase)obj;
      long oldMax = 0;
      if (setBytes) {
         if (setCache)
            oldMax = property.getMaxBytesCache();
         else
            oldMax = property.getMaxBytes();
      }
      else { // maxEntries
         if (setCache)
            oldMax = property.getMaxEntriesCache();
         else
            oldMax = property.getMaxEntries();
      }

      log.info(getStorageId() + ": Change request of max"+loc+"=" + oldMax + ", to " + max + " ...");

      if (max < oldMax)
         // Allow decreasing, not yet intense tested!!!
         // And TopicHandler.allowedToReconfigureTopicAndFixWrongLimits() limits it currently!
         ; //return getStorageId() + ": Currently max"+loc+"=" + oldMax + ", decreasing setMax"+loc+"(" + max + ") is not supported";
      else if (max == oldMax)
         return getStorageId() + ": Currently max"+loc+"=" + oldMax + ", changing to setMax"+loc+"(" + max + ") are identical";

      property = (QueuePropertyBase)property.clone();
      if (setBytes) {
         if (setCache)
            property.setMaxBytesCache(max);
         else
            property.setMaxBytes(max);
      }
      else { // maxEntries
         if (setCache)
            property.setMaxEntriesCache(max);
         else
            property.setMaxEntries(max);
      }
      String word = (max < oldMax) ? "decreased" : "increased";

      String tmpRet = getStorageId() + ": Successfully " + word + " max"+loc+"=" + oldMax + " to " + max + ". This is a NOT persistent change and is lost on restart when the configuration of existing msgUnits are recovered from harddisk";
     
View Full Code Here

      this.isShutdown = false;
   }

   public void setProperties(Object userData) throws XmlBlasterException {
      if (userData == null) return;
      QueuePropertyBase newProp;
      try {
         newProp = (QueuePropertyBase)userData;
      }
      catch(Throwable e) { // this.log is still null
         throw XmlBlasterException.convert(this.glob, ME, "Can't configure RAM map, your properties are invalid", e); // glob is allowed to be null
View Full Code Here

         this.contextNode = new ContextNode(ContextNode.QUEUE_MARKER_TAG, instanceName,
                             this.glob.getContextNode()); // TODO: pass from real parent like SubjectInfo
         this.mbeanHandle = this.glob.registerMBean(this.contextNode, this);

         QueuePluginManager pluginManager = glob.getQueuePluginManager();
         QueuePropertyBase queuePropertyBase = (QueuePropertyBase)userData;

         try {
           this.maxFetchSize = Long.valueOf(pluginProperties.getProperty("maxFetchSize", ""+maxFetchSize)).longValue();
         }
         catch (Throwable e) {
             log.warning(ME+"Setting maxFetchSize failed: " + e.toString());
         }

         //instantiate and initialize the underlying queues
         String defaultTransient = pluginProperties.getProperty("transientQueue", "RAM,1.0").trim();
         if (defaultTransient.startsWith(getType())) {
            log.severe(ME+"Cache queue configured with transientQueue=CACHE, to prevent recursion we set it to 'RAM,1.0'");
            defaultTransient = "RAM,1.0";
         }
         QueuePropertyBase ramProps = createRamCopy(queuePropertyBase);
         ramProps.setEmbedded(true);
         this.transientQueue = pluginManager.getPlugin(defaultTransient, uniqueQueueId, ramProps);
         //log.error(ME, "Debug only: " + this.transientQueue.toXml(""));
        
         try {
            String defaultPersistent = pluginProperties.getProperty("persistentQueue", "JDBC,1.0").trim();
View Full Code Here

   /**
    * We set the cache props to the real props for RAM queue running under a cacheQueue
    */
   private QueuePropertyBase createRamCopy(QueuePropertyBase queuePropertyBase) {
      QueuePropertyBase ramCopy = (QueuePropertyBase)queuePropertyBase.clone();
      ramCopy.setMaxEntries(queuePropertyBase.getMaxEntriesCache());
      ramCopy.setMaxBytes(queuePropertyBase.getMaxBytesCache());
      return ramCopy;
   }
View Full Code Here

   /**
    * @see I_Queue#setProperties(Object)
    */
   synchronized public void setProperties(Object userData) throws XmlBlasterException {
      if (userData == null) return;
      QueuePropertyBase newProp;
      try {
         newProp = (QueuePropertyBase)userData;
      }
      catch(Throwable e) {
         log.severe(ME+"Can't configure queue, your properties are invalid: " + e.toString());
View Full Code Here

   /**
    * @see I_Queue#setProperties(Object)
    */
   public void setProperties(Object userData) throws XmlBlasterException {
      if (userData == null) return;
      QueuePropertyBase newProp;
      try {
         newProp = (QueuePropertyBase)userData;
      }
      catch(Throwable e) {
         log.severe("Can't configure queue, your properties are invalid: " + e.toString());
View Full Code Here

      if (queue == null) {
         synchronized (this) {
            if (queue == null) {
               // Create a queue for this plugin, inherit the settings from the original queue of DispatchManager
               I_Queue origQueue = managerEntry.getDispatchManager().getQueue();
               QueuePropertyBase queueProperties = (QueuePropertyBase) origQueue.getProperties();
               String type = queueProperties.getType();
               String version = queueProperties.getVersion();
               String typeVersion = glob.getProperty().get("PriorizedDispatchPlugin.queue.plugin", type+","+version);
               StorageId storageId = new StorageId(glob, origQueue.getStorageId().getXBStore().getNode(),
                     "PriorizedDispatchPlugin", origQueue.getStorageId().getXBStore().getPostfix());
               queue = glob.getQueuePluginManager().getPlugin(typeVersion, storageId, queueProperties);
               queue.setNotifiedAboutAddOrRemove(true); // Entries are notified to support reference counting (otherwise we have memory leaks)
View Full Code Here

         if (log.isLoggable(Level.FINER))
            log.finer("init");

         // init the storages
         QueuePropertyBase sessionProp = new SessionStoreProperty(this.global, this.global.getStrippedId());
         if (sessionProp.getMaxEntries() > 0L) {
            String type = sessionProp.getType();
            String version = sessionProp.getVersion();
            // NEW: "heron", "session", "subPersistence,1.0"
            this.sessionStorageId = new StorageId(glob, this.global.getDatabaseNodeStr(), Constants.RELATING_SESSION,
                  this.info.getId());
            // OLD: "session", "heron/subPersistence,1.0"
            // this.sessionStorageId = new StorageId(glob,
            // Constants.RELATING_SESSION, this.global.getStrippedId() +"/" +
            // this.info.getId());
            // -> OLD: xb_entries.queuename="session_heronsubPersistence,1_0"
            this.sessionStore = this.global.getStoragePluginManager().getPlugin(type, version, this.sessionStorageId, sessionProp);
         }
         else {
            if (log.isLoggable(Level.FINE))
               log.fine(Constants.RELATING_SESSION + " persistence for session is switched off with maxEntries=0");
         }
         QueuePropertyBase subscribeProp = new SubscribeStoreProperty(this.global, this.global.getStrippedId());
         if (subscribeProp.getMaxEntries() > 0L) {
            String type = subscribeProp.getType();
            String version = subscribeProp.getVersion();
            this.subscribeStorageId = new StorageId(glob, this.global.getDatabaseNodeStr(),
                  Constants.RELATING_SUBSCRIBE,
                  this.info.getId());
            // id from xmlBlasterPlugins.xml: "subPersistence,1_0"
            // this.subscribeStorageId = new StorageId(glob,
View Full Code Here

    * @param queueName The name to be given as Id to this queue
    * @return returns the instance of the queue
    * @throws XmlBlasterException
    */
   private I_Queue initQueue(I_Queue queue, String queueName) throws XmlBlasterException {
      QueuePropertyBase prop = this.topicProperty.getHistoryQueueProperty();
      if (queue == null) {
         if (prop.getMaxEntries() > 0L) {
            String type = prop.getType();
            String version = prop.getVersion();
            StorageId queueId = new StorageId(serverScope, serverScope.getDatabaseNodeStr(), queueName, getUniqueKey());
            // StorageId queueId = new StorageId(serverScope, queueName,
            // serverScope.getNodeId()+"/"+getUniqueKey());
            queue = serverScope.getQueuePluginManager().getPlugin(type, version, queueId, prop);
            queue.setNotifiedAboutAddOrRemove(true); // Entries are notified to support reference counting
         }
         else {
            if (log.isLoggable(Level.FINE)) log.fine(ME+": " + queueName + " queuing of this topic is switched off with maxEntries=0");
         }
      }
      else {
         if (prop.getMaxEntries() > 0L) {
            log.info(ME+": Reconfiguring " + queueName + " queue.");
            queue.setProperties(prop);
         }
         else {
            log.warning(ME+": Destroying " + queueName + " queue with " + queue.getNumOfEntries() +
View Full Code Here

TOP

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

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.