This is akin to Buddhist practitioners who contemplate death. Their object is to be able to remain composed when their time comes, and move serenely on to their next life.
這和佛教修行者常觀想死亡以求避免臨事驚慌、可以安詳往生的原理一致。