Search in sources :

Example 1 with BBoxDBService

use of org.bboxdb.misc.BBoxDBService in project bboxdb by jnidzwetzki.

the class BBoxDBMain method start.

/**
 * Start all services
 */
public void start() {
    logger.info("Starting up BBoxDB - version: {}", Const.VERSION);
    if (!runBaseChecks()) {
        logger.error("Some of the base checks have failed, exiting");
        System.exit(-1);
    }
    // Init all services
    for (final BBoxDBService service : services) {
        try {
            logger.info("Starting service: {}", service.getServicename());
            service.init();
        } catch (Throwable e) {
            logger.error("Got exception while init service:" + service.getServicename(), e);
            stop();
            System.exit(-1);
        }
    }
    // Read membership
    final ZookeeperClient zookeeperClient = ZookeeperClientFactory.getZookeeperClient();
    BBoxDBInstanceManager.getInstance().startMembershipObserver(zookeeperClient);
}
Also used : ZookeeperClient(org.bboxdb.distribution.zookeeper.ZookeeperClient) BBoxDBService(org.bboxdb.misc.BBoxDBService)

Example 2 with BBoxDBService

use of org.bboxdb.misc.BBoxDBService in project bboxdb by jnidzwetzki.

the class BBoxDBMain method stop.

/**
 * Stop all services
 */
public void stop() {
    logger.info("Stopping the BBoxDB");
    // Stop all services
    for (final BBoxDBService service : services) {
        try {
            logger.info("Stopping service: {}", service.getServicename());
            service.shutdown();
        } catch (Throwable e) {
            logger.error("Got exception while stopping service:" + service.getServicename(), e);
        }
    }
    services.clear();
    logger.info("Shutdown complete");
}
Also used : BBoxDBService(org.bboxdb.misc.BBoxDBService)

Aggregations

BBoxDBService (org.bboxdb.misc.BBoxDBService)2 ZookeeperClient (org.bboxdb.distribution.zookeeper.ZookeeperClient)1