use of org.onlab.util.Backtrace in project onos by opennetworkinglab.
the class GossipIntentStore method write.
@Override
public void write(IntentData newData) {
checkNotNull(newData);
IntentData currentData = currentMap.get(newData.key());
if (IntentData.isUpdateAcceptable(currentData, newData)) {
// this always succeeds
if (newData.state() == PURGE_REQ) {
if (currentData != null) {
if (log.isTraceEnabled()) {
log.trace("Purging {} in currentMap. {}@{}", newData.key(), newData.state(), newData.version(), new Backtrace());
}
currentMap.remove(newData.key(), currentData);
} else {
log.info("Gratuitous purge request for intent: {}", newData.key());
}
} else {
if (log.isTraceEnabled()) {
log.trace("Putting {} in currentMap. {}@{}", newData.key(), newData.state(), newData.version(), new Backtrace());
}
currentMap.put(newData.key(), IntentData.copy(newData));
}
} else {
log.debug("Update for {} not acceptable from:\n{}\nto:\n{}", newData.key(), currentData, newData);
}
// Remove the intent data from the pending map if the newData is more
// recent or equal to the existing entry. No matter if it is an acceptable
// update or not
Key key = newData.key();
IntentData existingValue = pendingMap.get(key);
if (existingValue == null) {
return;
}
if (!existingValue.version().isNewerThan(newData.version())) {
pendingMap.remove(key, existingValue);
} else {
log.debug("{} in pending map was newer, leaving it there", key);
}
}
Aggregations