use of org.opendaylight.controller.cluster.datastore.utils.PruningDataTreeModification in project controller by opendaylight.
the class ShardDataTree method applyRecoveryCandidate.
@SuppressWarnings("checkstyle:IllegalCatch")
private void applyRecoveryCandidate(final DataTreeCandidate candidate) throws DataValidationFailedException {
final PruningDataTreeModification mod = wrapWithPruning(dataTree.takeSnapshot().newModification());
DataTreeCandidates.applyToModification(mod, candidate);
mod.ready();
final DataTreeModification unwrapped = mod.delegate();
LOG.trace("{}: Applying recovery modification {}", logContext, unwrapped);
try {
dataTree.validate(unwrapped);
dataTree.commit(dataTree.prepare(unwrapped));
} catch (Exception e) {
File file = new File(System.getProperty("karaf.data", "."), "failed-recovery-payload-" + logContext + ".out");
DataTreeModificationOutput.toFile(file, unwrapped);
throw new IllegalStateException(String.format("%s: Failed to apply recovery payload. Modification data was written to file %s", logContext, file), e);
}
}
Aggregations