Annotation Type Dispose


  • @Target(METHOD)
    @Retention(RUNTIME)
    public @interface Dispose
    Annotation indicating this method should be called on application shut down.

    Note that a reference is held to this bean by the lifecycle system, if this bean is not a singleton, and gets instantiated in response to regular events, you will run out of memory.

    Note: If this bean is provided by an @Provided method, then that method *must* be annotated with @Singleton, otherwise it won't be detected.

    Author:
    James Roper
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      int order
      The order in which it should be disposed, higher meaning earlier.
    • Element Detail

      • order

        int order
        The order in which it should be disposed, higher meaning earlier. While apps are free to use any ordering system they wish, the following convention is recommended:

        10 - Services that connect to resources and do not depend on other services, for example, database connections 20-80 - Services that depend on resources, but may still be needed for the app to complete its core functions 90 - Services that stop the app from doing its core functions, eg listening on queues, responding to HTTP requests

        Returns:
        The order, the greatest being stopped first, the least being stopped last.
        Default:
        50