Interface DestroyListener


@Contract @ConstrainedTo(SERVER) public interface DestroyListener
A listener contract that allows any registered implementation class to receive application destroy events.

The onDestroy() method is called when application is being destroyed and after all the pending monitoring statistics events have been dispatched and processed.

The advantage of using DestroyListener over using ApplicationEventListener directly to check for the ApplicationEvent.Type.DESTROY_FINISHED event is, that the onDestroy() method is guaranteed to be called only AFTER all the MonitoringStatisticsListener#onStatistics() events have been dispatched and processed, as opposed to using the ApplicationEventListener directly, in which case some monitoring statistics events may still be concurrently fired after the DESTROY_FINISHED event has been dispatched (due to potential race conditions).

Since:
2.12
Author:
Miroslav Fuksa, Adam Lindenthal
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The method is called when application is destroyed.
  • Method Details

    • onDestroy

      void onDestroy()
      The method is called when application is destroyed. Use this method release resources of the listener. This method will be called in the thread safe way (synchronously and by a single thread) according to other methods from the related MonitoringStatisticsListener interface.