@Override
 public void onStop() {
   if (conn != null) {
     conn.close();
     conn = null;
     producer.close();
     consumer.close();
   }
 }
 public void init(String kafkaServers, String dbServers, boolean restart) throws Exception {
   logger.info("connecting to cassandra");
   conn = new CassandraConn();
   conn.connect(dbServers);
   logger.info("create TweetDao");
   tweetDao = new TweetDao(conn);
   segDao = new SegStateDao(conn);
   logger.info("connecting to kafka");
   consumer = new TweetConsumer();
   consumer.open(
       Arrays.asList(KafkaTopics.RETWEET_TOPIC),
       KafkaTopics.RTSERIES_GROUP,
       kafkaServers,
       restart);
   producer = new TweetKafkaProducer(KafkaProducerFactory.createProducer(kafkaServers));
   MetricBasedPerfProfile.registerServer(controller);
 }