[时间是让人猝不及防的东西,晴时有风阴时有雨]
1.背景
在bolt中,需要在topology被关闭前执行某个操作,而根据官方文档:
The
cleanup
method is called when a Bolt is being shutdown and should cleanup any resources that were opened. There's no guarantee that this method will be called on the cluster: for example, if the machine the task is running on blows up, there's no way to invoke the method. The
cleanup
method is intended for when you run topologies in