in vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/NodeStash.java [207:279]
public void recover(@NotNull ImportMode importMode, @Nullable ImportInfo importInfo) throws RepositoryException {
// move the old child nodes back (independent of importMode)
int childNodeCount = 0;
long start = System.currentTimeMillis();
long lastTimeStamp = start;
boolean shouldWarn = false;
if (tmpNode != null) {
Node parent = session.getNode(path);
NodeIterator iter = tmpNode.getNodes();
boolean hasErrors = false;
while (iter.hasNext()) {
Node child = iter.nextNode();
String newPath = parent.getPath() + "/" + child.getName();
try {
if (session.nodeExists(newPath)) {
log.debug("Skipping restore from temporary location {} as node already exists at {}", child.getPath(), newPath);
} else {
String path = child.getPath();
session.move(path, newPath);
childNodeCount += 1;
if (importInfo != null) {
importInfo.onStashed(path);
}
long now = System.currentTimeMillis();
if (childNodeCount > 0 && now - PROGRESS_LOG_INTERVAL > lastTimeStamp) {
log.warn(
"Node stashing recovery operation for node {} (last: {} into {}), still running after {}, nodes recovered: {}",
this.path, path, newPath, Duration.ofMillis(now - start), childNodeCount);
lastTimeStamp = now;
shouldWarn = true;
}
}
} catch (RepositoryException e) {
log.warn(
"Unable to move child back to new location at {} due to: {}. Node will remain in temporary location: {}",
newPath, e.getMessage(), child.getPath());
if (importInfo != null) {
importInfo.onError(newPath, e);
hasErrors = true;
}
}
}
try {
recoverProperties(importMode == ImportMode.MERGE || importMode == ImportMode.MERGE_PROPERTIES);
} catch (RepositoryException e) {
log.warn("Unable to restore properties at {} due to: {}. Properties will remain in temporary location: {}", path,
e.getMessage(), tmpNode.getPath());
if (importInfo != null) {
importInfo.onError(path, e);
hasErrors = true;
}
}
log.debug("Restored properties and child nodes of {} from {} (mode: {}).", path, tmpNode.getPath(), importMode);
if (shouldWarn) {
String message = String.format(Locale.ENGLISH, "Stashed node recovery for %s done (%d child nodes, elapsed %s).", path,
childNodeCount, Duration.ofMillis(System.currentTimeMillis() - start));
log.warn(message);
}
if (!hasErrors) {
tmpNode.remove();
} else {
log.debug("Temporary node {} not removed due to errors while restoring child items.", tmpNode.getPath());
}
}
}