public void shutdown() {
   logger.info("Migration thread " + threadName + " shutting down");
   isRunning.set(false);
   interrupt();
   try {
     shutdownComplete.await();
   } catch (InterruptedException ie) {
     logger.warn("Interrupt during shutdown of MigrationThread", ie);
   }
   logger.info("Migration thread " + threadName + " shutdown complete");
 }
 public void shutdown() {
   try {
     logger.info("Producer thread " + threadName + " shutting down");
     producerDataChannel.sendRequest(shutdownMessage);
   } catch (InterruptedException ie) {
     logger.warn("Interrupt during shutdown of ProducerThread", ie);
   }
 }
 public void awaitShutdown() {
   try {
     shutdownComplete.await();
     producer.close();
     logger.info("Producer thread " + threadName + " shutdown complete");
   } catch (InterruptedException ie) {
     logger.warn("Interrupt during shutdown of ProducerThread", ie);
   }
 }
 public void run() {
   try {
     while (true) {
       KeyedMessage<byte[], byte[]> data = producerDataChannel.receiveRequest();
       if (!data.equals(shutdownMessage)) {
         producer.send(data);
         if (logger.isDebugEnabled())
           logger.debug(String.format("Sending message %s", new String(data.message())));
       } else break;
     }
     logger.info("Producer thread " + threadName + " finished running");
   } catch (Throwable t) {
     logger.fatal("Producer thread failure due to ", t);
   } finally {
     shutdownComplete.countDown();
   }
 }
    public void run() {
      try {
        Method MessageGetPayloadMethod_07 = KafkaMessageClass_07.getMethod("payload");
        Method KafkaGetMessageMethod_07 = KafkaMessageAndMetatDataClass_07.getMethod("message");
        Method KafkaGetTopicMethod_07 = KafkaMessageAndMetatDataClass_07.getMethod("topic");
        Method ConsumerIteratorMethod = KafkaStream_07.getMethod("iterator");
        Method KafkaStreamHasNextMethod_07 = KafkaConsumerIteratorClass_07.getMethod("hasNext");
        Method KafkaStreamNextMethod_07 = KafkaConsumerIteratorClass_07.getMethod("next");
        Object iterator = ConsumerIteratorMethod.invoke(stream);

        while (((Boolean) KafkaStreamHasNextMethod_07.invoke(iterator)).booleanValue()) {
          Object messageAndMetaData_07 = KafkaStreamNextMethod_07.invoke(iterator);
          Object message_07 = KafkaGetMessageMethod_07.invoke(messageAndMetaData_07);
          Object topic = KafkaGetTopicMethod_07.invoke(messageAndMetaData_07);
          Object payload_07 = MessageGetPayloadMethod_07.invoke(message_07);
          int size = ((ByteBuffer) payload_07).remaining();
          byte[] bytes = new byte[size];
          ((ByteBuffer) payload_07).get(bytes);
          if (logger.isDebugEnabled())
            logger.debug(
                "Migration thread "
                    + threadId
                    + " sending message of size "
                    + bytes.length
                    + " to topic "
                    + topic);
          KeyedMessage<byte[], byte[]> producerData = new KeyedMessage((String) topic, null, bytes);
          producerDataChannel.sendRequest(producerData);
        }
        logger.info("Migration thread " + threadName + " finished running");
      } catch (InvocationTargetException t) {
        logger.fatal("Migration thread failure due to root cause ", t.getCause());
      } catch (Throwable t) {
        logger.fatal("Migration thread failure due to ", t);
      } finally {
        shutdownComplete.countDown();
      }
    }