// as some line below getAll() gets all of them!
this.topicStore = glob.getStoragePluginManager().getPlugin(type, version, topicStoreId, topicStoreProperty);
//this.topicStore = new org.xmlBlaster.engine.msgstore.ram.MapPlugin();
log.info("Activated storage '" + this.topicStore.getStorageId() + "' for persistent topics, found " + this.topicStore.getNumOfEntries() + " topics to recover.");
MsgUnitStoreProperty limitM = new MsgUnitStoreProperty(glob, null); // The current limit from xmlBlaster.properties
HistoryQueueProperty limitH = new HistoryQueueProperty(glob, null); // The current limit
I_MapEntry[] mapEntryArr = this.topicStore.getAll(null);
boolean fromPersistenceStore = true;
for(int i=0; i<mapEntryArr.length; i++) {
TopicEntry topicEntry = (TopicEntry)mapEntryArr[i];
PublishQosServer publishQosServer = new PublishQosServer(glob,
(MsgQosData)topicEntry.getMsgUnit().getQosData(), fromPersistenceStore);
publishQosServer.setTopicEntry(topicEntry); // Misuse PublishQosServer to transport the topicEntry
boolean existsAlready = (glob.getTopicAccessor().accessDirtyRead(topicEntry.getKeyOid()) != null);
if (existsAlready) {
log.warning("Removing duplicate of topic '" + topicEntry.getLogId() + "' from persistence store");
try {
this.topicStore.remove(topicEntry);
}
catch (XmlBlasterException e) {
log.severe("Removing duplicate of topic '" + topicEntry.getLogId() + "' from persistence store makes problems: " + e.getMessage());
}
continue;
}
try {
// Check limits
TopicProperty topicProps = ((MsgQosData)topicEntry.getMsgUnit().getQosData()).getTopicProperty();
if (topicProps != null && topicProps.getMsgUnitStoreProperty() != null) {
MsgUnitStoreProperty p = topicProps.getMsgUnitStoreProperty();
if (p.getMaxBytes() > limitM.getMaxBytes()) { // How to prevent a smaller limit than actual bytes on HD?
p.setMaxBytes(limitM.getMaxBytes());
}
if (p.getMaxBytesCache() > limitM.getMaxBytesCache()) {
p.setMaxBytesCache(limitM.getMaxBytesCache());
}
if (p.getMaxEntries() > limitM.getMaxEntries()) { // How to prevent a smaller limit than actual entries on HD?
p.setMaxEntries(limitM.getMaxEntries());
}
if (p.getMaxEntriesCache() > limitM.getMaxEntriesCache()) {
p.setMaxEntriesCache(limitM.getMaxEntriesCache());
}
}
if (topicProps != null && topicProps.getHistoryQueueProperty() != null) {
HistoryQueueProperty h = topicProps.getHistoryQueueProperty();