PublishKey publishKey = new PublishKey(glob, "HA");
PublishQosServer publishQosServer = new PublishQosServer(glob, "<qos><persistent/></qos>");
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());
log.fine("SUCESS BEFORE: " + msgUnitWrapper.toXml());
log.fine("SUCESS AFTER: " + newWrapper.toXml());
}
}
}
catch (XmlBlasterException e) {
System.out.println("ERROR " + e.getMessage());