From c5aeaa7d898ce4b21e3204cd805d0b2c508e24eb Mon Sep 17 00:00:00 2001 From: Ismael Juma Date: Sat, 13 May 2017 08:15:30 +0100 Subject: [PATCH] MINOR: Improve shutdown sequence Author: Ismael Juma Reviewers: Jun Rao Closes #3030 from ijuma/improve-shutdown-sequence --- core/src/main/scala/kafka/server/KafkaServer.scala | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/kafka/server/KafkaServer.scala b/core/src/main/scala/kafka/server/KafkaServer.scala index 431d192169f..fdf837cb656 100755 --- a/core/src/main/scala/kafka/server/KafkaServer.scala +++ b/core/src/main/scala/kafka/server/KafkaServer.scala @@ -589,28 +589,35 @@ class KafkaServer(val config: KafkaConfig, time: Time = Time.SYSTEM, threadNameP if (shutdownLatch.getCount > 0 && isShuttingDown.compareAndSet(false, true)) { CoreUtils.swallow(controlledShutdown()) brokerState.newState(BrokerShuttingDown) + if (socketServer != null) CoreUtils.swallow(socketServer.shutdown()) if (requestHandlerPool != null) CoreUtils.swallow(requestHandlerPool.shutdown()) + CoreUtils.swallow(kafkaScheduler.shutdown()) + if (apis != null) CoreUtils.swallow(apis.close()) CoreUtils.swallow(authorizer.foreach(_.close())) - if (replicaManager != null) - CoreUtils.swallow(replicaManager.shutdown()) if (adminManager != null) CoreUtils.swallow(adminManager.shutdown()) + if (transactionCoordinator != null) CoreUtils.swallow(transactionCoordinator.shutdown()) if (groupCoordinator != null) CoreUtils.swallow(groupCoordinator.shutdown()) + + if (replicaManager != null) + CoreUtils.swallow(replicaManager.shutdown()) if (logManager != null) CoreUtils.swallow(logManager.shutdown()) + if (kafkaController != null) CoreUtils.swallow(kafkaController.shutdown()) if (zkUtils != null) CoreUtils.swallow(zkUtils.close()) + if (metrics != null) CoreUtils.swallow(metrics.close())