use of com.google.inject.Injector in project gerrit by GerritCodeReview.
the class LabelNormalizerTest method setUpInjector.
@Before
public void setUpInjector() throws Exception {
Injector injector = Guice.createInjector(new InMemoryModule());
injector.injectMembers(this);
lifecycle = new LifecycleManager();
lifecycle.add(injector);
lifecycle.start();
db = schemaFactory.open();
schemaCreator.create(db);
userId = accountManager.authenticate(AuthRequest.forUser("user")).getAccountId();
user = userFactory.create(userId);
requestContext.setContext(new RequestContext() {
@Override
public CurrentUser getUser() {
return user;
}
@Override
public Provider<ReviewDb> getReviewDbProvider() {
return Providers.of(db);
}
});
configureProject();
setUpChange();
}
use of com.google.inject.Injector in project torodb by torodb.
the class ToroDbBootstrap method createStandaloneService.
public static Service createStandaloneService(Config config, Clock clock) {
Injector bootstrapInjector = Guice.createInjector(new BootstrapModule(config, clock));
ThreadFactory threadFactory = bootstrapInjector.getInstance(ThreadFactory.class);
return new ToroDbService(threadFactory, bootstrapInjector);
}
use of com.google.inject.Injector in project torodb by torodb.
the class StampedeBootstrap method createStampedeService.
public static Service createStampedeService(BootstrapModule bootstrapModule) {
Injector bootstrapInjector = Guice.createInjector(bootstrapModule);
ThreadFactory threadFactory = bootstrapInjector.getInstance(ThreadFactory.class);
return new StampedeService(threadFactory, bootstrapInjector);
}
use of com.google.inject.Injector in project torodb by torodb.
the class StampedeService method startUp.
@Override
protected void startUp() throws Exception {
LOGGER.info("Starting up ToroDB Stampede");
shutdowner = bootstrapInjector.getInstance(Shutdowner.class);
shutdowner.awaitRunning();
BackendBundle backendBundle = createBackendBundle();
startBundle(backendBundle);
BackendService backendService = backendBundle.getBackendService();
ConsistencyHandler consistencyHandler = createConsistencyHandler(backendService);
if (!consistencyHandler.isConsistent()) {
LOGGER.info("Database is not consistent. Cleaning it up");
dropDatabase(backendService);
}
Injector finalInjector = createFinalInjector(backendBundle, consistencyHandler);
AbstractReplication replication = getReplication();
reportReplication(replication);
TorodBundle torodBundle = createTorodBundle(finalInjector);
startBundle(torodBundle);
MongodbReplConfig replConfig = getReplConfig(replication);
startBundle(createMongodbReplBundle(finalInjector, torodBundle, replConfig));
LOGGER.info("ToroDB Stampede is now running");
}
use of com.google.inject.Injector in project graphhopper by graphhopper.
the class GHServer method start.
public void start() throws Exception {
Injector injector = Guice.createInjector(createModule());
start(injector);
}
Aggregations