if (documentStore.localStore().putIfAbsent(rootKey.toString(), rootDoc) == null) {
// we are the first node to perform the initialization, so we need to link the system node
if (!RepositoryCache.this.systemWorkspaceName.equals(name)) {
logger.debug("Creating '{0}' workspace in repository '{1}'", name, getName());
SessionCache workspaceSession = new WritableSessionCache(context, workspaceCache, sessionContext);
MutableCachedNode workspaceRootNode = workspaceSession.mutable(workspaceSession.getRootKey());
workspaceRootNode.linkChild(workspaceSession, RepositoryCache.this.systemKey, JcrLexicon.SYSTEM);
// this will be enrolled in the active transaction
workspaceSession.save();
}
}
return workspaceCache;
}
});