in broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java [1395:1614]
protected void shutdownBasicService() {
shutdown = true;
this.unregisterBrokerAll();
if (this.shutdownHook != null) {
this.shutdownHook.beforeShutdown(this);
}
for (Map.Entry<String, RemotingServer> entry : remotingServerMap.entrySet()) {
RemotingServer remotingServer = entry.getValue();
if (remotingServer != null) {
remotingServer.shutdown();
}
}
if (this.brokerMetricsManager != null) {
this.brokerMetricsManager.shutdown();
}
if (this.brokerStatsManager != null) {
this.brokerStatsManager.shutdown();
}
if (this.clientHousekeepingService != null) {
this.clientHousekeepingService.shutdown();
}
if (this.pullRequestHoldService != null) {
this.pullRequestHoldService.shutdown();
}
if (this.popConsumerService != null) {
this.popConsumerService.shutdown();
}
if (this.popMessageProcessor.getPopLongPollingService() != null) {
this.popMessageProcessor.getPopLongPollingService().shutdown();
}
if (this.popMessageProcessor.getQueueLockManager() != null) {
this.popMessageProcessor.getQueueLockManager().shutdown();
}
if (this.popMessageProcessor.getPopBufferMergeService() != null) {
this.popMessageProcessor.getPopBufferMergeService().shutdown();
}
if (this.ackMessageProcessor.getPopReviveServices() != null) {
this.ackMessageProcessor.shutdownPopReviveService();
}
if (this.transactionalMessageService != null) {
this.transactionalMessageService.close();
}
if (this.notificationProcessor != null) {
this.notificationProcessor.getPopLongPollingService().shutdown();
}
if (this.consumerIdsChangeListener != null) {
this.consumerIdsChangeListener.shutdown();
}
if (this.topicQueueMappingCleanService != null) {
this.topicQueueMappingCleanService.shutdown();
}
//it is better to make sure the timerMessageStore shutdown firstly
if (this.timerMessageStore != null) {
this.timerMessageStore.shutdown();
}
if (this.fileWatchService != null) {
this.fileWatchService.shutdown();
}
if (this.broadcastOffsetManager != null) {
this.broadcastOffsetManager.shutdown();
}
if (this.messageStore != null) {
this.messageStore.shutdown();
}
if (this.replicasManager != null) {
this.replicasManager.shutdown();
}
shutdownScheduledExecutorService(this.scheduledExecutorService);
if (this.sendMessageExecutor != null) {
this.sendMessageExecutor.shutdown();
}
if (this.litePullMessageExecutor != null) {
this.litePullMessageExecutor.shutdown();
}
if (this.pullMessageExecutor != null) {
this.pullMessageExecutor.shutdown();
}
if (this.replyMessageExecutor != null) {
this.replyMessageExecutor.shutdown();
}
if (this.putMessageFutureExecutor != null) {
this.putMessageFutureExecutor.shutdown();
}
if (this.ackMessageExecutor != null) {
this.ackMessageExecutor.shutdown();
}
if (this.adminBrokerExecutor != null) {
this.adminBrokerExecutor.shutdown();
}
if (this.brokerFastFailure != null) {
this.brokerFastFailure.shutdown();
}
if (this.consumerFilterManager != null) {
this.consumerFilterManager.persist();
}
if (this.scheduleMessageService != null) {
this.scheduleMessageService.persist();
this.scheduleMessageService.shutdown();
}
if (this.clientManageExecutor != null) {
this.clientManageExecutor.shutdown();
}
if (this.queryMessageExecutor != null) {
this.queryMessageExecutor.shutdown();
}
if (this.heartbeatExecutor != null) {
this.heartbeatExecutor.shutdown();
}
if (this.consumerManageExecutor != null) {
this.consumerManageExecutor.shutdown();
}
if (this.transactionalMessageCheckService != null) {
this.transactionalMessageCheckService.shutdown(false);
}
if (this.endTransactionExecutor != null) {
this.endTransactionExecutor.shutdown();
}
if (this.transactionMetricsFlushService != null) {
this.transactionMetricsFlushService.shutdown();
}
if (this.escapeBridge != null) {
this.escapeBridge.shutdown();
}
if (this.topicRouteInfoManager != null) {
this.topicRouteInfoManager.shutdown();
}
if (this.brokerPreOnlineService != null && !this.brokerPreOnlineService.isStopped()) {
this.brokerPreOnlineService.shutdown();
}
if (this.coldDataPullRequestHoldService != null) {
this.coldDataPullRequestHoldService.shutdown();
}
if (this.coldDataCgCtrService != null) {
this.coldDataCgCtrService.shutdown();
}
shutdownScheduledExecutorService(this.syncBrokerMemberGroupExecutorService);
shutdownScheduledExecutorService(this.brokerHeartbeatExecutorService);
if (this.topicConfigManager != null) {
this.topicConfigManager.persist();
this.topicConfigManager.stop();
}
if (this.subscriptionGroupManager != null) {
this.subscriptionGroupManager.persist();
this.subscriptionGroupManager.stop();
}
if (this.consumerOffsetManager != null) {
this.consumerOffsetManager.persist();
this.consumerOffsetManager.stop();
}
if (this.consumerOrderInfoManager != null) {
this.consumerOrderInfoManager.persist();
this.consumerOrderInfoManager.shutdown();
}
if (this.configStorage != null) {
this.configStorage.shutdown();
}
if (this.authenticationMetadataManager != null) {
this.authenticationMetadataManager.shutdown();
}
if (this.authorizationMetadataManager != null) {
this.authorizationMetadataManager.shutdown();
}
for (BrokerAttachedPlugin brokerAttachedPlugin : brokerAttachedPlugins) {
if (brokerAttachedPlugin != null) {
brokerAttachedPlugin.shutdown();
}
}
}