Package org.xmlBlaster.util.queue

Examples of org.xmlBlaster.util.queue.I_QueueEntry


                                         receiver, subscriptionId, updateOneway);
         entry.incrRedeliverCounter();
         entry.incrRedeliverCounter();

         queue.put(entry, false);
         I_QueueEntry returnEntry = queue.peek();

         boolean isUpdate = (returnEntry instanceof MsgQueueUpdateEntry);
         assertTrue("updateEntry: the return value is not an update ", isUpdate);
        
         MsgQueueUpdateEntry updateEntry = (MsgQueueUpdateEntry)returnEntry;
View Full Code Here


         org.xmlBlaster.engine.ServerScope global = new org.xmlBlaster.engine.ServerScope();
         MsgUnitWrapper msgWrapper = new MsgUnitWrapper(glob, msgUnit, queue.getStorageId());
         MsgQueueHistoryEntry entry = new MsgQueueHistoryEntry(global, msgWrapper, queue.getStorageId());

         queue.put(entry, false);
         I_QueueEntry returnEntry = queue.peek();

         boolean isHistory = (returnEntry instanceof MsgQueueHistoryEntry);
         assertTrue("historyEntry: the return value is not an update ", isHistory);
        
         MsgQueueHistoryEntry historyEntry = (MsgQueueHistoryEntry)returnEntry;
View Full Code Here

   public I_QueueEntry take() throws XmlBlasterException
   {
      // note that this method could be drastically improved
      // however it is unlikely to be used so I avoid that tuning now
      synchronized (this.modificationMonitor) {
         I_QueueEntry ret = this.peek();
         this.removeRandom(ret.getUniqueId());
         return ret;
      }
   }
View Full Code Here

      if (this.persistentQueue == null) return; // should never happen

      try {
         boolean isInclusive = true; // if the reference is the original one then it is inclusive, if it is a new one then it is exclusive
         I_QueueEntry limitEntry = null; // this.referenceEntry;
         if (log.isLoggable(Level.FINE)) {
            if (limitEntry == null) log.fine(ME+"The reference entry is null");
            else log.fine(ME+"The reference entry is '" + limitEntry.getUniqueId() + "' and its flag 'stored' is '" + limitEntry.isStored() + "'");
         }
         List<I_Entry> list = null;

         if (limitEntry == null || limitEntry.isStored()) {
            isInclusive = false;
            limitEntry = this.transientQueue.peek(); // get the first entry in the RAM queue as ref
            if (log.isLoggable(Level.FINE)) {
               if (limitEntry == null) log.fine(ME+"The new reference entry is null");
               else log.fine(ME+"The new reference entry is '" + limitEntry.getUniqueId() + "'");
            }
         }
         if (limitEntry == null) { // then ram queue was empty when it lost connection and is empty now
            isInclusive = false;
            this.persistentQueue.clear();
View Full Code Here

   public I_QueueEntry take() throws XmlBlasterException
   {
      // note that this method could be drastically improved
      // however it is unlikely to be used so I avoid that tuning now
      synchronized (modificationMonitor) {
         I_QueueEntry ret = peek();
         removeRandom(ret.getUniqueId());
         return ret;
      }
   }
View Full Code Here

                        log.fine(ME+"Swapping: moving '" + swaps.size() + "' entries from transient queue to persistent queue: exceedingEntries='" + exceedingEntries + "' and exceedingSize='" + exceedingSize + "'");
                     }
                     // get the transients
                     transients = new ArrayList<I_Entry>();
                     for (int i=0; i < swaps.size(); i++) {
                        I_QueueEntry entry = (I_QueueEntry)swaps.get(i);
                        if (!entry.isPersistent()) {
                           transients.add(entry);
                        }
                     }
                     if (transients.size() > 0)
                        this.persistentQueue.put((I_QueueEntry[])transients.toArray(new I_QueueEntry[transients.size()]), ignorePutInterceptor);
View Full Code Here

   }

   // JMX
   public String peekStr() throws Exception {
      try {
         I_QueueEntry entry = peek();
         return (entry == null) ? "No entry found" :
                     entry.getLogId() + " - " + entry.getSizeInBytes() + " bytes - " +
                     ((entry.isPersistent()) ? "persistent" : "transient") +
                     " prio=" + entry.getPriority() +
                     " " + entry.getEmbeddedType(); // no toXml() available ??
      }
      catch(XmlBlasterException e) {
         throw new Exception(e);
      }
   }
View Full Code Here

         List<I_Entry> list = peek(numOfEntries, -1L);
         if (list == null || list.size()<1)
            return new String[] { "No entry found" };
         String[] ret = new String[list.size()];
         for (int i=0; i<list.size(); i++) {
            I_QueueEntry entry = (I_QueueEntry)list.get(i);
            // no toXml() available ??
            ret[i] = entry.getLogId() + " - " + entry.getSizeInBytes() + " bytes - " +
                     ((entry.isPersistent()) ? "persistent" : "transient") +
                     " prio=" + entry.getPriority() +
                     " " + entry.getEmbeddedType(); // no toXml() available ??
         }
         return ret;
      }
      catch (XmlBlasterException e) {
         throw new Exception(e);
View Full Code Here

         // 1. Look into persistent store ...
         List<I_Entry> list = null;
         try {
            List<I_Entry> listLowest = this.transientQueue.peekLowest(1, -1, null, false);
            I_QueueEntry firstEntry = null;
            if (listLowest.size() == 1) {
               firstEntry = (I_QueueEntry)listLowest.get(0);
            }
            list = this.persistentQueue.peekStartAt((int)freeEntries, freeBytes, firstEntry);
         }
View Full Code Here

      // peek one msg and then remove it one by one ..
      t0 = System.currentTimeMillis();
      for (int j=0; j < numOfMsg; j++) {
         for (int i=0; i < numOfQueues; i++) {
            I_QueueEntry entry = queues[i].peek();
            queues[i].removeRandom(entry);
         }
      }
      t1 = System.currentTimeMillis() - t0;
      log.info("peek /removeRandom one by one " + numOfMsg + " messages in " + numOfQueues + " queues took " + (1.0*t1/1000) + " seconds");
View Full Code Here

TOP

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

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.