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();
if (h.getMaxBytes() > limitH.getMaxBytes()) {
h.setMaxBytes(limitH.getMaxBytes());
}
if (h.getMaxBytesCache() > limitH.getMaxBytesCache()) {
h.setMaxBytesCache(limitH.getMaxBytesCache());
}
if (h.getMaxEntries() > limitH.getMaxEntries()) {
h.setMaxEntries(limitH.getMaxEntries());
}
if (h.getMaxEntriesCache() > limitH.getMaxEntriesCache()) {
h.setMaxEntriesCache(limitH.getMaxEntriesCache());
}
}
publish(unsecureSessionInfo, topicEntry.getMsgUnit(), publishQosServer);
// Called after sessions/subscriptions are recovered from SessionPersistencePlugin:
// glob.getTopicAccessor().spanTopicDestroyTimeout();
}
catch (XmlBlasterException e) {
log.severe("Restoring topic '" + topicEntry.getMsgUnit().getKeyOid() + "' from persistency failed: " + e.getMessage());
}
}
}
else {
log.info("Reconfiguring topics store.");