contextDestroyed() will be called only when you gracefully shut down the server by opening the Servers view and clicking on the server instance and selecting Stop, or by clicking the red button in the Servers view, in the Stop the server prompt.
It is not called when the server is completely shut down by pressing the red button in the console view, the prompt of which indicates Terminate. Stopping (killing) is not the same as stopping.
source share