Package org.xmlBlaster.util.queue.cache

Examples of org.xmlBlaster.util.queue.cache.CacheQueueInterceptorPlugin


      for (int i=0; i < entries1; i++) {
         this.queue.put(entries[i], false);
//         assertEquals(ME + " number of entries after putting transients is wrong ", transients.length, queue.getNumOfEntries());
      }

      CacheQueueInterceptorPlugin cacheQueue = (CacheQueueInterceptorPlugin)this.queue;
      cacheQueue.storageUnavailable(I_StorageProblemListener.AVAILABLE);

      for (int i=entries1; i < entries2; i++) {
         this.queue.put(entries[i], false);
      }

      List<I_Entry> list = this.queue.peek(-1, -1L);
      assertEquals(ME + " number of entries when retrieving is wrong ", entries2, list.size());
      for (int i=0; i < list.size(); i++) {
         long uniqueId = ((I_QueueEntry)list.get(i)).getUniqueId();
         assertEquals(ME + " entry sequence is wrong ", entries[i].getUniqueId(), uniqueId);
      }
      long ret = 0L;
      boolean[] tmpArr = this.queue.removeRandom( (I_QueueEntry[])list.toArray(new I_QueueEntry[list.size()]) );
      for (int i=0; i < tmpArr.length; i++) if (tmpArr[i]) ret++;
      assertEquals(ME + " number of entries removed is wrong ", (long)entries2, ret);

      list = this.queue.peek(-1, -1L);
      assertEquals(ME + " number of entries peeked after removal is wrong ", 0, list.size());

      long num = this.queue.getNumOfEntries();
      assertEquals(ME + " number of entries after removal is wrong ", 0L, num);

      cacheQueue.storageAvailable(I_StorageProblemListener.UNAVAILABLE);
      list = this.queue.peek(-1, -1L);
      assertEquals(ME + " number of entries peeked after reconnecting is wrong ", 0, list.size());

      num = this.queue.getNumOfEntries();
      assertEquals(ME + " number of entries after reconnecting is wrong ", 0L, num);
View Full Code Here


   public final long getCbQueueBytesCache() {
      I_Queue sq = this.sessionQueue;
      if (sq == null) return 0L;
      if (sq instanceof CacheQueueInterceptorPlugin) {
         CacheQueueInterceptorPlugin cq = (CacheQueueInterceptorPlugin)sq;
         I_Queue tq = cq.getTransientQueue();
         if (tq != null) return tq.getNumOfBytes();
         return 0L;
      }
      return -1L;
   }
View Full Code Here

   public final long getCbQueueNumMsgsCache() {
      I_Queue sq = this.sessionQueue;
      if (sq == null) return 0L;
      if (sq instanceof CacheQueueInterceptorPlugin) {
         CacheQueueInterceptorPlugin cq = (CacheQueueInterceptorPlugin)sq;
         I_Queue tq = cq.getTransientQueue();
         if (tq != null) return tq.getNumOfEntries();
         return 0L;
      }
      return -1L;
   }
View Full Code Here

   public final long getCbQueueMaxMsgsCache() {
      I_Queue sq = this.sessionQueue;
      if (sq == null) return 0L;
      if (sq instanceof CacheQueueInterceptorPlugin) {
          CacheQueueInterceptorPlugin cq = (CacheQueueInterceptorPlugin)sq;
          I_Queue tq = cq.getTransientQueue();
          if (tq != null) return tq.getMaxNumOfEntries();
          return 0L;
      }
      return -1L;
   }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.queue.cache.CacheQueueInterceptorPlugin

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.