in twill-core/src/main/java/org/apache/twill/internal/kafka/EmbeddedKafkaServer.java [53:77]
protected void startUp() throws Exception {
int tries = 0;
do {
KafkaServer kafkaServer = createKafkaServer(kafkaConfig);
try {
kafkaServer.startup();
server = kafkaServer;
} catch (Exception e) {
kafkaServer.shutdown();
kafkaServer.awaitShutdown();
Throwable rootCause = Throwables.getRootCause(e);
if (rootCause instanceof ZkTimeoutException) {
// Potentially caused by race condition bug described in TWILL-139.
LOG.warn("Timeout when connecting to ZooKeeper from KafkaServer. Attempt number {}.", tries, rootCause);
} else {
throw e;
}
}
} while (server == null && ++tries < startTimeoutRetries);
if (server == null) {
throw new IllegalStateException("Failed to start Kafka server after " + tries + " attempts.");
}
}