Permalink
Browse files

Ensure garmadon forwarder doesn't hang when prometheus http server ca…

…n't start

Change-Id: Idcdc4d9f71d5059bf23d2db0023aafe87a9c7691
JIRA:LAKECOMP-828
  • Loading branch information...
ashangit authored and qabot escalation committed Oct 8, 2018
1 parent a654ef9 commit 30662f46ee4a21684be2d12c096c0ae0054eaf9d
@@ -98,10 +98,9 @@ public void close() {
LOGGER.info("Shutdown netty server");
if (serverChannel == null) {
LOGGER.error("Cannot close a non running server");
throw new IllegalStateException("Cannot close a non running server");
} else {
serverChannel.close().syncUninterruptibly();
}
serverChannel.close().syncUninterruptibly();
if (bossGroup != null) {
bossGroup.shutdownGracefully().syncUninterruptibly();
}
@@ -15,7 +15,7 @@
private final KafkaProducer<String, byte[]> producer;
private final String topic;
public KafkaService(Properties properties){
public KafkaService(Properties properties) {
this.topic = "garmadon";
this.producer = new KafkaProducer<>(properties);
}
@@ -34,7 +34,9 @@ public void sendRecordAsync(String key, byte[] value) {
}
public void shutdown() {
producer.flush();
producer.close();
if (producer != null) {
producer.flush();
producer.close();
}
}
}

0 comments on commit 30662f4

Please sign in to comment.