@Test public void testQueryModeEnabledWithDummyModule() { Configuration config = Configuration.getInstance(); config.setProperty(CoreConfig.QUERY_MODE, "true"); config.setProperty(CoreConfig.QUERY_MODULES, "com.rackspacecloud.blueflood.service.DummyQueryService"); BluefloodServiceStarter.run(); assertNotNull(DummyQueryService.getInstances()); assertEquals(1, DummyQueryService.getInstances().size()); assertNotNull(DummyQueryService.getMostRecentInstance()); assertTrue(DummyQueryService.getMostRecentInstance().getStartServiceCalled()); }
public static void run() { Configuration config = Configuration.getInstance(); String log4jConfig = System.getProperty("log4j.configuration"); if (log4jConfig != null && log4jConfig.startsWith("file:")) { PropertyConfigurator.configureAndWatch(log4jConfig.substring("file:".length()), 5000); } validateCassandraHosts(); boolean usePersistedCache = Configuration.getInstance().getBooleanProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_ENABLED); if (usePersistedCache) { String path = Configuration.getInstance().getStringProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_PATH); final File cacheLocation = new File(path); if (cacheLocation.exists()) { try { DataInputStream in = new DataInputStream(new FileInputStream(cacheLocation)); MetadataCache.getInstance().load(in); in.close(); } catch (IOException ex) { log.error(ex.getMessage(), ex); } } else { log.info("Wanted to load metadata cache, but it did not exist: " + path); } Timer cachePersistenceTimer = new Timer("Metadata-Cache-Persistence"); int savePeriodMins = Configuration.getInstance().getIntegerProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_PERIOD_MINS); cachePersistenceTimer.schedule(new TimerTask() { @Override public void run() { try { DataOutputStream out = new DataOutputStream(new FileOutputStream(cacheLocation, false)); MetadataCache.getInstance().save(out); out.close(); } catch (IOException ex) { log.error(ex.getMessage(), ex); } } }, TimeUnit.MINUTES.toMillis(savePeriodMins), TimeUnit.MINUTES.toMillis(savePeriodMins)); } new RestartGauge(getRegistry(), RollupService.class); final Collection<Integer> shards = Collections.unmodifiableCollection( Util.parseShards(config.getStringProperty(CoreConfig.SHARDS))); final String zkCluster = config.getStringProperty(CoreConfig.ZOOKEEPER_CLUSTER); final boolean rollupMode = config.getBooleanProperty(CoreConfig.ROLLUP_MODE); final ScheduleContext rollupContext = !"NONE".equals(zkCluster) && rollupMode ? new ScheduleContext(System.currentTimeMillis(), shards, zkCluster) : new ScheduleContext(System.currentTimeMillis(), shards); log.info("Starting blueflood services"); startShardStateServices(rollupContext); startIngestServices(rollupContext); startQueryServices(); startRollupService(rollupContext); startEventListenerModules(); log.info("All blueflood services started"); }
BluefloodServiceStarter { public static void run() { Configuration config = Configuration.getInstance(); String log4jConfig = System.getProperty("log4j.configuration"); if (log4jConfig != null && log4jConfig.startsWith("file:")) { PropertyConfigurator.configureAndWatch(log4jConfig.substring("file:".length()), 5000); } validateCassandraHosts(); boolean usePersistedCache = Configuration.getInstance().getBooleanProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_ENABLED); if (usePersistedCache) { String path = Configuration.getInstance().getStringProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_PATH); final File cacheLocation = new File(path); if (cacheLocation.exists()) { try { DataInputStream in = new DataInputStream(new FileInputStream(cacheLocation)); MetadataCache.getInstance().load(in); in.close(); } catch (IOException ex) { log.error(ex.getMessage(), ex); } } else { log.info("Wanted to load metadata cache, but it did not exist: " + path); } Timer cachePersistenceTimer = new Timer("Metadata-Cache-Persistence"); int savePeriodMins = Configuration.getInstance().getIntegerProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_PERIOD_MINS); cachePersistenceTimer.schedule(new TimerTask() { @Override public void run() { try { DataOutputStream out = new DataOutputStream(new FileOutputStream(cacheLocation, false)); MetadataCache.getInstance().save(out); out.close(); } catch (IOException ex) { log.error(ex.getMessage(), ex); } } }, TimeUnit.MINUTES.toMillis(savePeriodMins), TimeUnit.MINUTES.toMillis(savePeriodMins)); } new RestartGauge(getRegistry(), RollupService.class); final Collection<Integer> shards = Collections.unmodifiableCollection( Util.parseShards(config.getStringProperty(CoreConfig.SHARDS))); final String zkCluster = config.getStringProperty(CoreConfig.ZOOKEEPER_CLUSTER); final boolean rollupMode = config.getBooleanProperty(CoreConfig.ROLLUP_MODE); final ScheduleContext rollupContext = !"NONE".equals(zkCluster) && rollupMode ? new ScheduleContext(System.currentTimeMillis(), shards, zkCluster) : new ScheduleContext(System.currentTimeMillis(), shards); log.info("Starting blueflood services"); startShardStateServices(rollupContext); startIngestServices(rollupContext); startQueryServices(); startRollupService(rollupContext); startEventListenerModules(); log.info("All blueflood services started"); } }
BluefloodServiceStarter { public static void run() { Configuration config = Configuration.getInstance(); String log4jConfig = System.getProperty("log4j.configuration"); if (log4jConfig != null && log4jConfig.startsWith("file:")) { PropertyConfigurator.configureAndWatch(log4jConfig.substring("file:".length()), 5000); } validateCassandraHosts(); boolean usePersistedCache = Configuration.getInstance().getBooleanProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_ENABLED); if (usePersistedCache) { String path = Configuration.getInstance().getStringProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_PATH); final File cacheLocation = new File(path); if (cacheLocation.exists()) { try { DataInputStream in = new DataInputStream(new FileInputStream(cacheLocation)); MetadataCache.getInstance().load(in); in.close(); } catch (IOException ex) { log.error(ex.getMessage(), ex); } } else { log.info("Wanted to load metadata cache, but it did not exist: " + path); } Timer cachePersistenceTimer = new Timer("Metadata-Cache-Persistence"); int savePeriodMins = Configuration.getInstance().getIntegerProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_PERIOD_MINS); cachePersistenceTimer.schedule(new TimerTask() { @Override public void run() { try { DataOutputStream out = new DataOutputStream(new FileOutputStream(cacheLocation, false)); MetadataCache.getInstance().save(out); out.close(); } catch (IOException ex) { log.error(ex.getMessage(), ex); } } }, TimeUnit.MINUTES.toMillis(savePeriodMins), TimeUnit.MINUTES.toMillis(savePeriodMins)); } new RestartGauge(getRegistry(), RollupService.class); final Collection<Integer> shards = Collections.unmodifiableCollection( Util.parseShards(config.getStringProperty(CoreConfig.SHARDS))); final String zkCluster = config.getStringProperty(CoreConfig.ZOOKEEPER_CLUSTER); final boolean rollupMode = config.getBooleanProperty(CoreConfig.ROLLUP_MODE); final ScheduleContext rollupContext = !"NONE".equals(zkCluster) && rollupMode ? new ScheduleContext(System.currentTimeMillis(), shards, zkCluster) : new ScheduleContext(System.currentTimeMillis(), shards); log.info("Starting blueflood services"); startShardStateServices(rollupContext); startIngestServices(rollupContext); startQueryServices(); startRollupService(rollupContext); startEventListenerModules(); log.info("All blueflood services started"); }  }
BluefloodServiceStarter { public static void run() { Configuration config = Configuration.getInstance(); String log4jConfig = System.getProperty("log4j.configuration"); if (log4jConfig != null && log4jConfig.startsWith("file:")) { PropertyConfigurator.configureAndWatch(log4jConfig.substring("file:".length()), 5000); } validateCassandraHosts(); boolean usePersistedCache = Configuration.getInstance().getBooleanProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_ENABLED); if (usePersistedCache) { String path = Configuration.getInstance().getStringProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_PATH); final File cacheLocation = new File(path); if (cacheLocation.exists()) { try { DataInputStream in = new DataInputStream(new FileInputStream(cacheLocation)); MetadataCache.getInstance().load(in); in.close(); } catch (IOException ex) { log.error(ex.getMessage(), ex); } } else { log.info("Wanted to load metadata cache, but it did not exist: " + path); } Timer cachePersistenceTimer = new Timer("Metadata-Cache-Persistence"); int savePeriodMins = Configuration.getInstance().getIntegerProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_PERIOD_MINS); cachePersistenceTimer.schedule(new TimerTask() { @Override public void run() { try { DataOutputStream out = new DataOutputStream(new FileOutputStream(cacheLocation, false)); MetadataCache.getInstance().save(out); out.close(); } catch (IOException ex) { log.error(ex.getMessage(), ex); } } }, TimeUnit.MINUTES.toMillis(savePeriodMins), TimeUnit.MINUTES.toMillis(savePeriodMins)); } new RestartGauge(getRegistry(), RollupService.class); final Collection<Integer> shards = Collections.unmodifiableCollection( Util.parseShards(config.getStringProperty(CoreConfig.SHARDS))); final String zkCluster = config.getStringProperty(CoreConfig.ZOOKEEPER_CLUSTER); final boolean rollupMode = config.getBooleanProperty(CoreConfig.ROLLUP_MODE); final ScheduleContext rollupContext = !"NONE".equals(zkCluster) && rollupMode ? new ScheduleContext(System.currentTimeMillis(), shards, zkCluster) : new ScheduleContext(System.currentTimeMillis(), shards); log.info("Starting blueflood services"); startShardStateServices(rollupContext); startIngestServices(rollupContext); startQueryServices(); startRollupService(rollupContext); startEventListenerModules(); log.info("All blueflood services started"); }  static void validateCassandraHosts(); static void main(String args[]); static void run(); static MetricRegistry getRegistry(); }
BluefloodServiceStarter { public static void run() { Configuration config = Configuration.getInstance(); String log4jConfig = System.getProperty("log4j.configuration"); if (log4jConfig != null && log4jConfig.startsWith("file:")) { PropertyConfigurator.configureAndWatch(log4jConfig.substring("file:".length()), 5000); } validateCassandraHosts(); boolean usePersistedCache = Configuration.getInstance().getBooleanProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_ENABLED); if (usePersistedCache) { String path = Configuration.getInstance().getStringProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_PATH); final File cacheLocation = new File(path); if (cacheLocation.exists()) { try { DataInputStream in = new DataInputStream(new FileInputStream(cacheLocation)); MetadataCache.getInstance().load(in); in.close(); } catch (IOException ex) { log.error(ex.getMessage(), ex); } } else { log.info("Wanted to load metadata cache, but it did not exist: " + path); } Timer cachePersistenceTimer = new Timer("Metadata-Cache-Persistence"); int savePeriodMins = Configuration.getInstance().getIntegerProperty(CoreConfig.METADATA_CACHE_PERSISTENCE_PERIOD_MINS); cachePersistenceTimer.schedule(new TimerTask() { @Override public void run() { try { DataOutputStream out = new DataOutputStream(new FileOutputStream(cacheLocation, false)); MetadataCache.getInstance().save(out); out.close(); } catch (IOException ex) { log.error(ex.getMessage(), ex); } } }, TimeUnit.MINUTES.toMillis(savePeriodMins), TimeUnit.MINUTES.toMillis(savePeriodMins)); } new RestartGauge(getRegistry(), RollupService.class); final Collection<Integer> shards = Collections.unmodifiableCollection( Util.parseShards(config.getStringProperty(CoreConfig.SHARDS))); final String zkCluster = config.getStringProperty(CoreConfig.ZOOKEEPER_CLUSTER); final boolean rollupMode = config.getBooleanProperty(CoreConfig.ROLLUP_MODE); final ScheduleContext rollupContext = !"NONE".equals(zkCluster) && rollupMode ? new ScheduleContext(System.currentTimeMillis(), shards, zkCluster) : new ScheduleContext(System.currentTimeMillis(), shards); log.info("Starting blueflood services"); startShardStateServices(rollupContext); startIngestServices(rollupContext); startQueryServices(); startRollupService(rollupContext); startEventListenerModules(); log.info("All blueflood services started"); }  static void validateCassandraHosts(); static void main(String args[]); static void run(); static MetricRegistry getRegistry();  }