Package org.xmlBlaster.util.qos.storage

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


         log.warning("Ignoring problem during JMX session registration: " + e.toString());
      }
    this.updateQueue = new RamQueuePlugin();
    this.storageId = new StorageId(glob, glob.getDatabaseNodeStr(), RELATED_AJAX, this.sessionId);
    // glob.getNodeId().getId() is not yet available:
    QueuePropertyBase queueProps = new CbQueueProperty(glob, RELATED_AJAX, "/node/dummy");
    queueProps.setMaxEntries(100L);
    queueProps.setMaxBytes(200000L);
    this.updateQueue.initialize(storageId, queueProps);
    this.blockingQueueWrapper = new BlockingQueueWrapper(500L);
    this.blockingQueueWrapper.init(this.updateQueue);
    log.info(id + " Created new sessionId=" + this.sessionId);
    this.xmlBlasterAccess.registerConnectionListener(new I_ConnectionStateListener() {
View Full Code Here


//------------------------------------
   public void testGetMsg() {

      String queueType = "unknown";
      try {
         QueuePropertyBase prop = new MsgUnitStoreProperty(glob, "/node/test");
         queueType = this.currMap.toString();
         StorageId queueId = new StorageId(glob, "msgUnitStore", "MapPlugin/getMsg");
         this.currMap.initialize(queueId, prop);
         this.currMap.clear();
         assertEquals(ME + "wrong size before starting ", 0, this.currMap.getNumOfEntries());
View Full Code Here

//------------------------------------
   public void testGetAllMsgs() {

      String queueType = "unknown";
      try {
         QueuePropertyBase prop = new MsgUnitStoreProperty(glob, "/node/test");
         queueType = this.currMap.toString();
         StorageId queueId = new StorageId(glob, "msgUnitStore", "MapPlugin/getAllMsgs");
         this.currMap.initialize(queueId, prop);
         this.currMap.clear();
         assertEquals(ME + "wrong size before starting ", 0, this.currMap.getNumOfEntries());
View Full Code Here

//------------------------------------
   public void testGetAllSwappedMsgs() {

      String queueType = "unknown";
      try {
         QueuePropertyBase prop = new MsgUnitStoreProperty(glob, "/node/test");
         queueType = this.currMap.toString();
         StorageId queueId = new StorageId(glob, "msgUnitStore", "MapPlugin/getAllSwappedMsgs");
         prop.setMaxEntries(10);      // Overall size (RAM or JDBC or CACHE)
         prop.setMaxEntriesCache(2)// Is only interpreted for cache implementations (-> the size of the RAM map)
         this.currMap.initialize(queueId, prop);
         this.currMap.clear();
         assertEquals(ME + "wrong size before starting ", 0, this.currMap.getNumOfEntries());
         getAllSwappedMsgs(this.currMap);
      }
View Full Code Here

    */
   private void getAllSwappedMsgs(I_Map i_map) {
      ME = "I_MapTest.getAllSwappedMsgs(" + i_map.getStorageId() + ")[" + i_map.getClass().getName() + "]";
      System.out.println("***" + ME);
     
      QueuePropertyBase prop = (QueuePropertyBase)i_map.getProperties();
      assertEquals(ME+": Wrong capacity", 10, prop.getMaxEntries());
      assertEquals(ME+": Wrong cache capacity", 2, prop.getMaxEntriesCache());
      log.info("Current settings: " + prop.toXml());

      try {
         //========== Test 1: getAllSwapped()
         {
            MsgUnitWrapper[] queueEntries = {
View Full Code Here


   public void testPutEntriesTwice() {
      String queueType = "unknown";
      try {
         QueuePropertyBase prop = new MsgUnitStoreProperty(glob, "/node/test");
         queueType = this.currMap.toString();
         StorageId queueId = new StorageId(glob, "msgUnitStore", "MapPlugin/putEntriesTwice");
         this.currMap.initialize(queueId, prop);
         this.currMap.clear();
         assertEquals(ME + " wrong size before starting ", 0, this.currMap.getNumOfEntries());
View Full Code Here

    */
   private void config(I_Map i_map) {
      ME = "I_MapTest.config(" + i_map.getStorageId() + ")[" + i_map.getClass().getName() + "]";
      System.out.println("***" + ME);

      QueuePropertyBase prop1 = null;
      QueuePropertyBase prop = null;
      try {
         // test initialize()
         prop1 = new MsgUnitStoreProperty(glob, "/node/test");
         int max = 12;
         prop1.setMaxEntries(max);
         prop1.setMaxEntriesCache(max);
         assertEquals(ME+": Wrong capacity", max, prop1.getMaxEntries());
         assertEquals(ME+": Wrong cache capacity", max, prop1.getMaxEntriesCache());
         StorageId queueId = new StorageId(glob, "msgUnitStore", "SomeMapId");

         i_map.initialize(queueId, prop1);
         assertEquals(ME+": Wrong queue ID", queueId, i_map.getStorageId());

         try {
            prop = new MsgUnitStoreProperty(glob, "/node/test");
            prop.setMaxEntries(99);
            prop.setMaxEntriesCache(99);
            i_map.setProperties(prop);
         }
         catch(XmlBlasterException e) {
            fail("Changing properties failed: " + e.getMessage());
         }

      }
      catch(XmlBlasterException e) {
         fail(ME + ": Exception thrown: " + e.getMessage());
      }

      long len = prop.getMaxEntries();
      assertEquals(ME+": Wrong capacity", prop.getMaxEntries(), i_map.getMaxNumOfEntries());
      assertEquals(ME+": Wrong capacity", prop.getMaxEntries(), ((QueuePropertyBase)i_map.getProperties()).getMaxEntries());
      assertEquals(ME+": Wrong size", 0, i_map.getNumOfEntries());

      try {
         for (int ii=0; ii<len; ii++) {
            i_map.put(new MsgUnitWrapper(glob, createMsgUnit(false), i_map.getStorageId()));
View Full Code Here

//------------------------------------
   public void testPutMsg() {
      String queueType = "unknown";
      try {
         QueuePropertyBase prop = new MsgUnitStoreProperty(glob, "/node/test");
         queueType = this.currMap.toString();
         StorageId queueId = new StorageId(glob, "msgUnitStore", "MapPlugin/putMsg");
         this.currMap.initialize(queueId, prop);
         this.currMap.clear();
         assertEquals(ME + "wrong size before starting ", 0L, this.currMap.getNumOfEntries());
View Full Code Here

      I_Map i_map = this.currMap;
      ME = "I_MapTest.testByteOverflow(" + i_map.getStorageId() + ")[" + i_map.getClass().getName() + "]";
      System.out.println("***" + ME);
      try {
         StorageId storageId = new StorageId(glob, "msgUnitStore", "ByteOverflowMapId");
         QueuePropertyBase prop = new MsgUnitStoreProperty(glob, "/node/test");

         MsgUnitWrapper mu = new MsgUnitWrapper(glob, createMsgUnit(false, 0),  storageId);
         long sizeEmpty = mu.getSizeInBytes();

         MsgUnitWrapper[] queueEntries = {
            new MsgUnitWrapper(glob, createMsgUnit(false, 0),  storageId),
            new MsgUnitWrapper(glob, createMsgUnit(false, 0),  storageId),
            new MsgUnitWrapper(glob, createMsgUnit(false, 0),  storageId),
            // Each above entry has 3,311 bytes = 9,922, the next one has 9,932 bytes
            // so when it is entered two of the above need to be swapped away
            // as maxBytes=13,244
            new MsgUnitWrapper(glob, createMsgUnit(false, 2*sizeEmpty-1), storageId),
            new MsgUnitWrapper(glob, createMsgUnit(false, 0),  storageId)};

         final long maxBytesCache = 4*sizeEmpty;
         prop.setMaxBytes(1000000);
         prop.setMaxBytesCache(maxBytesCache);
         assertEquals(ME+": Wrong capacity", 1000000, prop.getMaxBytes());
         assertEquals(ME+": Wrong cache capacity", maxBytesCache, prop.getMaxBytesCache());
         i_map.initialize(storageId, prop);
         assertEquals(ME+": Wrong queue ID", storageId, i_map.getStorageId());

         long numOfBytes = 0;
         for(int i=0; i<queueEntries.length; i++) {
View Full Code Here

   }

   public void putWithBreak() throws XmlBlasterException {
      String me = ME + ".putWithBreak";
      // set up the queues ....
      QueuePropertyBase prop = new CbQueueProperty(glob, Constants.RELATING_CALLBACK, "/node/test");
      prop.setMaxEntries(10000);
      StorageId queueId = new StorageId(glob, Constants.RELATING_CALLBACK, "putWithBreak");
      queue.initialize(queueId, prop);
      queue.clear();

      int num = 20;
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.