const mixinafIoc::RegistryShutdown
afIoc::RegistryShutdown
(Service) - Contribute functions to be executed on Registry shutdown. All functions need to be immutable, which essentially means they can only reference const
classes. Example usage:
class AppModule { @Contribute { serviceType=RegistryShutdown# } static Void contributeRegistryShutdown(Configuration conf, MyService myService) { conf["myShutdownFunc"] = |->| { myService.shutdown() } } }
If the shutdown method of your service depends on other services being available, add a constraint on afIoc.shutdown
:
conf.set("myShutdownFunc", |->| { myService.shutdown() }).before("afIoc.shutdown")
Note that Errs thrown by shutdown functions will be logged and then swallowed.
@uses Configuration of |->| []