Skip to content

Commit fb091ad

Browse files
authored
[ISSUE #3995]🚀Implement Drop trait for BrokerRuntime to ensure proper shutdown on drop (#3996)
1 parent 5502f05 commit fb091ad

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

rocketmq-broker/src/broker_runtime.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ pub(crate) struct BrokerRuntime {
136136
scheduled_task_manager: ScheduledTaskManager,
137137
}
138138

139+
impl Drop for BrokerRuntime {
140+
fn drop(&mut self) {
141+
if let Some(broker_runtime) = self.broker_runtime.take() {
142+
broker_runtime.shutdown();
143+
}
144+
}
145+
}
146+
139147
impl BrokerRuntime {
140148
pub(crate) fn new(
141149
broker_config: Arc<BrokerConfig>,

0 commit comments

Comments
 (0)