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 config, MyService myService) {
config["myShutdownFunc"] = |->| { myService.shutdown() }
}
}
If your shutdown method depends on other services still being available, add a constraint on their shutdown functions:
shutdownFunc := |->| { myService.shutdown() }
config.set("myShutdownFunc", shutdownFunc).before("otherShutdownFunc")IoC also defines a general use constraint placeholder named afIoc.shutdown.
Note that any Errs thrown by shutdown functions will be logged and then swallowed.
@uses Configuration of |->| []