Example #1
0
  @LifecycleStart
  public void start() throws IOException {
    for (final FireDepartment fireDepartment : fireDepartments) {
      DataSchema schema = fireDepartment.getDataSchema();

      final FireChief chief = new FireChief(fireDepartment);
      List<FireChief> chiefs = this.chiefs.get(schema.getDataSource());
      if (chiefs == null) {
        chiefs = new ArrayList<FireChief>();
        this.chiefs.put(schema.getDataSource(), chiefs);
      }
      chiefs.add(chief);

      chief.setName(
          String.format(
              "chief-%s[%s]",
              schema.getDataSource(),
              fireDepartment.getTuningConfig().getShardSpec().getPartitionNum()));
      chief.setDaemon(true);
      chief.start();
    }
  }
 @Override
 public Appenderator build(
     final DataSchema schema,
     final RealtimeTuningConfig config,
     final FireDepartmentMetrics metrics) {
   return Appenderators.createRealtime(
       schema,
       config.withBasePersistDirectory(
           makeBasePersistSubdirectory(
               config.getBasePersistDirectory(), schema.getDataSource(), config.getShardSpec())),
       metrics,
       dataSegmentPusher,
       objectMapper,
       indexIO,
       indexMerger,
       conglomerate,
       segmentAnnouncer,
       emitter,
       queryExecutorService,
       cache,
       cacheConfig);
 }
 @After
 public void tearDown() throws Exception {
   EasyMock.verify(announcer, segmentPublisher, dataSegmentPusher, serverView, emitter);
   FileUtils.deleteDirectory(
       new File(tuningConfig.getBasePersistDirectory(), schema.getDataSource()));
 }