The precondition check could end up using a lot of memory due to dump of the
data tree. Implement a simpler version and use that in the message.
Change-Id: I494cb92c7f4691d235e8ffac6f79c696e4ea0f48
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
414ea232f11da87dbdfbb1a7a10155b93e93b853)
LOG.debug("Updating datastore from {} to {}", currentRoot, newRoot);
final TreeNode oldRoot = c.getBeforeRoot();
LOG.debug("Updating datastore from {} to {}", currentRoot, newRoot);
final TreeNode oldRoot = c.getBeforeRoot();
- Preconditions.checkState(oldRoot == currentRoot, "Store tree %s and candidate base %s differ.", currentRoot, oldRoot);
+ if (oldRoot != currentRoot) {
+ final String oldStr = simpleToString(oldRoot);
+ final String currentStr = simpleToString(currentRoot);
+ throw new IllegalStateException("Store tree " + currentStr + " and candidate base " + oldStr + " differ.");
+ }
newState = currentState.withRoot(newRoot);
LOG.trace("Updated state from {} to {}", currentState, newState);
} while (!STATE_UPDATER.compareAndSet(this, currentState, newState));
}
newState = currentState.withRoot(newRoot);
LOG.trace("Updated state from {} to {}", currentState, newState);
} while (!STATE_UPDATER.compareAndSet(this, currentState, newState));
}
+ private static String simpleToString(final Object o) {
+ return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode());
+ }
+
@Override
public YangInstanceIdentifier getRootPath() {
return rootPath;
@Override
public YangInstanceIdentifier getRootPath() {
return rootPath;