Package org.xmlBlaster.util.queue

Examples of org.xmlBlaster.util.queue.I_EntryFactory


         PublishQosServer publishQosServer = new PublishQosServer(glob, xml, true); // true prevents new timestamp
         MsgUnit msgUnit = new MsgUnit(publishKey.getData(), "HO".getBytes(), publishQosServer.getData());
         StorageId storageId = new StorageId(glob, "mystore", "someid");
         MsgUnitWrapper msgUnitWrapper = new MsgUnitWrapper(glob, msgUnit, storageId);

         I_EntryFactory factory = glob.getEntryFactory(); // storageId.getStrippedId()

         /* MsgUnitWrapper.getOwnerCache() fails with this test as RequestBroker is unknown
         msgUnitWrapper.incrementReferenceCounter(4);
         assertEquals("", 4, msgUnitWrapper.getReferenceCounter());
         msgUnitWrapper.incrementReferenceCounter(-4);
         assertEquals("", 0, msgUnitWrapper.getReferenceCounter());
         */

         int priority = msgUnitWrapper.getPriority();
         long uniqueId = msgUnitWrapper.getUniqueId();
         String type = msgUnitWrapper.getEmbeddedType();
         boolean persistent = msgUnitWrapper.isPersistent();
         long sizeInBytes = msgUnitWrapper.getSizeInBytes();
         byte[] blob = factory.toBlob(msgUnitWrapper);

         MsgUnitWrapper newWrapper = (MsgUnitWrapper)factory.createEntry(priority,
                                        uniqueId, type, persistent, sizeInBytes, new ByteArrayInputStream(blob), storageId);
         assertEquals("", msgUnitWrapper.getPriority(), newWrapper.getPriority());
         assertEquals("", msgUnitWrapper.getReferenceCounter(), newWrapper.getReferenceCounter()); // A reference counter is reset to 0 when loaded from persistence
         assertEquals("", msgUnitWrapper.isExpired(), newWrapper.isExpired());
View Full Code Here


               publishQosServer.getData().setPriority(PriorityEnum.HIGH_PRIORITY);
               MsgUnit msgUnit = new MsgUnit(publishKey.getData(), "HO".getBytes(), publishQosServer.getData());
               StorageId storageId = new StorageId(glob, "heron", "mystore", "someid");
               MsgUnitWrapper msgUnitWrapper = new MsgUnitWrapper(glob, msgUnit, null, storageId, 0, 0, persistType[jj], -1);
               msgUnitWrapper.startExpiryTimer();
               I_EntryFactory factory = glob.getEntryFactory();

               int priority = msgUnitWrapper.getPriority();
               long timestamp = msgUnitWrapper.getUniqueId();
               String type = msgUnitWrapper.getEmbeddedType();
               boolean persistent = msgUnitWrapper.isPersistent();
               long sizeInBytes = msgUnitWrapper.getSizeInBytes();

               int numTransform = 1000;
               org.xmlBlaster.util.StopWatch stopWatchToBlob = new org.xmlBlaster.util.StopWatch();
               for(int kk=0; kk<numTransform; kk++) {
                  /*byte[] blob =*/ factory.toBlob(msgUnitWrapper);
               }
               double elapsed = stopWatchToBlob.elapsed();
               log.info("num toBlob=" + numTransform + " elapsed=" + elapsed + stopWatchToBlob.nice());

               byte[] blob = factory.toBlob(msgUnitWrapper);
               MsgUnitWrapper newWrapper = null;
               org.xmlBlaster.util.StopWatch stopWatchToObj = new org.xmlBlaster.util.StopWatch();
               for(int kk=0; kk<numTransform; kk++) {
                  newWrapper = (MsgUnitWrapper)factory.createEntry(priority,
                                              timestamp, type, persistent, sizeInBytes, new ByteArrayInputStream(blob), storageId);
               }
               elapsed = stopWatchToObj.elapsed();
               log.info("num toObj=" + numTransform + " elapsed=" + elapsed + stopWatchToObj.nice());

View Full Code Here

TOP

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

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.