* @return true if the change is accepted
*/
private final boolean allowedToReconfigureTopicAndFixWrongLimits(MsgQosData msgQosData) {
if (this.topicProperty == null)
return true;
TopicProperty topicProps = msgQosData.getTopicProperty();
if (topicProps == null) {
log.warning("The TopicProperty is null, not reconfiguring anything");
return false;
}
MsgUnitStoreProperty msgUnitStoreProps = topicProps.getMsgUnitStoreProperty();
if (msgUnitStoreProps == null) {
log.warning("The msgUnitStoreProps are null, not reconfiguring anything");
return false;
}
MsgUnitStoreProperty currentMsgUnitStoreProps = this.topicProperty.getMsgUnitStoreProperty();
long currentMaxBytes = currentMsgUnitStoreProps.getMaxBytes();
long currentMaxBytesCache = currentMsgUnitStoreProps.getMaxBytesCache();
long currentMaxEntries = currentMsgUnitStoreProps.getMaxEntries();
long currentMaxEntriesCache = currentMsgUnitStoreProps.getMaxEntriesCache();
StringBuffer report = new StringBuffer(1024);
// msgUnitStoreProps.getMaxBytesProp().isSet() checks if the value is explicitely set by a client
if (msgUnitStoreProps.getMaxBytes() == 0 || !msgUnitStoreProps.getMaxBytesProp().isSet() && currentMaxBytes > msgUnitStoreProps.getMaxBytes()) {
report.append("msgUnitStore: 'currentMaxBytes='" + currentMaxBytes + "' > than what publish proposed: '" + msgUnitStoreProps.getMaxBytes() + "' will leave it to '" + currentMaxBytes + "'\n");
msgUnitStoreProps.setMaxBytes(currentMaxBytes);
}
if (msgUnitStoreProps.getMaxBytesCache() == 0 || !msgUnitStoreProps.getMaxBytesCacheProp().isSet() && currentMaxBytesCache > msgUnitStoreProps.getMaxBytesCache()) {
report.append("msgUnitStore: 'currentMaxBytesCache='" + currentMaxBytesCache + "' > than what publish proposed: '" + msgUnitStoreProps.getMaxBytesCache() + "' will leave it to '" + currentMaxBytesCache + "'\n");
msgUnitStoreProps.setMaxBytesCache(currentMaxBytesCache);
}
if (msgUnitStoreProps.getMaxEntries() == 0 || !msgUnitStoreProps.getMaxEntriesProp().isSet() && currentMaxEntries > msgUnitStoreProps.getMaxEntries()) {
report.append("msgUnitStore: 'currentMaxEntries='" + currentMaxEntries + "' > than what publish proposed: '" + msgUnitStoreProps.getMaxEntries() + "' will leave it to '" + currentMaxEntries + "'\n");
msgUnitStoreProps.setMaxEntries(currentMaxEntries);
}
if (msgUnitStoreProps.getMaxEntriesCache() == 0 || !msgUnitStoreProps.getMaxEntriesCacheProp().isSet() && currentMaxEntriesCache > msgUnitStoreProps.getMaxEntriesCache()) {
report.append("msgUnitStore: 'currentMaxEntriesCache='" + currentMaxEntriesCache + "' > than what publish proposed: '" + msgUnitStoreProps.getMaxEntriesCache() + "' will leave it to '" + currentMaxEntriesCache + "'\n");
msgUnitStoreProps.setMaxEntriesCache(currentMaxEntriesCache);
}
log.info("new msgUnitStore Props: " + msgUnitStoreProps.toXml());
HistoryQueueProperty historyProps = topicProps.getHistoryQueueProperty();
if (historyProps != null) {
HistoryQueueProperty currentHistoryProps = this.topicProperty.getHistoryQueueProperty();
currentMaxBytes = currentHistoryProps.getMaxBytes();
currentMaxBytesCache = currentHistoryProps.getMaxBytesCache();
currentMaxEntries = currentHistoryProps.getMaxEntries();