Comment #102 on issue 62 by [email protected]: Lifecycle support
http://code.google.com/p/google-guice/issues/detail?id=62
It would be nice to see some help in Guice to build a service framework but
it isn't needed, since startup order of services could be possibly
different from injection dependecy order.
In my framework I made it something like Bob meantioned. I used an the
InjectionListenr / ProvisionListener to collect services implementing the
frameworks service interface and after injection finished the frameworks
ServiceManager collects and orders the services startup dependencies,
searches for postConstruct() handlers and finally calls the startup()
method of every service.
When the framework is shutting down first all services preDestroy() method
is called and finally the destroy() method.
Right after that point the ServiceManager and the Injector are destroyed.
It was a bit tricky at some small points but that is more a problem of the
framework, which can be sticked together from plugins (all have their own
AbstractModule) and a plugin descriptor, not a Guice problem.
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en.