Search in sources :

Example 1 with Shutdowner

use of com.torodb.core.Shutdowner 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");
}
Also used : BackendService(com.torodb.core.backend.BackendService) Shutdowner(com.torodb.core.Shutdowner) Injector(com.google.inject.Injector) BackendBundle(com.torodb.core.backend.BackendBundle) MongodbReplConfig(com.torodb.mongodb.repl.guice.MongodbReplConfig) ConsistencyHandler(com.torodb.mongodb.repl.ConsistencyHandler) AbstractReplication(com.torodb.packaging.config.model.protocol.mongo.AbstractReplication) TorodBundle(com.torodb.torod.TorodBundle)

Example 2 with Shutdowner

use of com.torodb.core.Shutdowner in project torodb by torodb.

the class CoreModule method createShutdowner.

@Provides
@Singleton
protected Shutdowner createShutdowner(ThreadFactory threadFactory) {
    Shutdowner s = new Shutdowner(threadFactory);
    s.startAsync();
    s.awaitRunning();
    return s;
}
Also used : Shutdowner(com.torodb.core.Shutdowner) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 3 with Shutdowner

use of com.torodb.core.Shutdowner in project torodb by torodb.

the class ToroDbService method startUp.

@Override
protected void startUp() throws Exception {
    LOGGER.info("Starting up ToroDB Standalone");
    shutdowner = bootstrapInjector.getInstance(Shutdowner.class);
    BackendBundle backendBundle = createBackendBundle();
    startBundle(backendBundle);
    Injector finalInjector = createFinalInjector(backendBundle);
    TorodBundle torodBundle = createTorodBundle(finalInjector);
    startBundle(torodBundle);
    LOGGER.info("ToroDB Stampede is now running");
}
Also used : Shutdowner(com.torodb.core.Shutdowner) Injector(com.google.inject.Injector) BackendBundle(com.torodb.core.backend.BackendBundle) TorodBundle(com.torodb.torod.TorodBundle)

Aggregations

Shutdowner (com.torodb.core.Shutdowner)3 Injector (com.google.inject.Injector)2 BackendBundle (com.torodb.core.backend.BackendBundle)2 TorodBundle (com.torodb.torod.TorodBundle)2 Provides (com.google.inject.Provides)1 Singleton (com.google.inject.Singleton)1 BackendService (com.torodb.core.backend.BackendService)1 ConsistencyHandler (com.torodb.mongodb.repl.ConsistencyHandler)1 MongodbReplConfig (com.torodb.mongodb.repl.guice.MongodbReplConfig)1 AbstractReplication (com.torodb.packaging.config.model.protocol.mongo.AbstractReplication)1