use of com.google.gerrit.pgm.init.index.IndexManagerOnInit in project gerrit by GerritCodeReview.
the class BaseInit method run.
@Override
public int run() throws Exception {
final SiteInit init = createSiteInit();
if (beforeInit(init)) {
return 0;
}
init.flags.autoStart = getAutoStart() && init.site.isNew;
init.flags.dev = isDev() && init.site.isNew;
init.flags.skipPlugins = skipPlugins();
init.flags.deleteCaches = getDeleteCaches();
init.flags.isNew = init.site.isNew;
final SiteRun run;
try {
init.initializer.run();
init.flags.deleteOnFailure = false;
Injector sysInjector = createSysInjector(init);
IndexManagerOnInit indexManager = sysInjector.getInstance(IndexManagerOnInit.class);
try {
indexManager.start();
run = createSiteRun(init);
try {
run.upgradeSchema();
} catch (StorageException e) {
String msg = "Couldn't upgrade schema. Expected if slave and read-only database";
System.err.println(msg);
logger.atSevere().withCause(e).log("%s", msg);
}
init.initializer.postRun(sysInjector);
} finally {
indexManager.stop();
}
} catch (Exception | Error failure) {
if (init.flags.deleteOnFailure) {
recursiveDelete(getSitePath());
}
throw failure;
}
System.err.println("Initialized " + getSitePath().toRealPath().normalize());
afterInit(run);
return 0;
}
Aggregations