Annotation Type CloseOnStop


  • @Qualifier
    @Retention(CLASS)
    @Target({METHOD,PARAMETER,TYPE})
    public @interface CloseOnStop
    Qualifier to use on Object type providers to indicate the provided objects should be closed after server shutdown.

    For example,

    
     {@literal @}Module
     public class MyModule {
       {@literal @}Provides
       {@literal @}Singleton
       public Database database() {
         return Database.connect();
       }
    
       {@literal @Provides}
       {@literal @ElementsIntoSet}
       {@literal @CloseOnStop}
       public Set<Closeable> init(Database database) {
         return ImmutableSet.of(database);
       }
     }