Why not create your own hub which your db services register with when they
are realized / constructed. You then have a single shutdown listener which
loops the list in order before finally shutting down the db connection.
 On 14 Oct 2013 17:38, "Muhammad Gelbana" <m.gelb...@gmail.com> wrote:

> This cannot guarantee the order of the shutdown procedure. I need this
> executed after all services are shutdown. However, I can inject another
> service instead of *RegistryShutdownHub*, this way I can guarantee the
> order.
>
> To explain, I'll inject a service which will hold a set of database
> connection services to be shutdown last. This service is contributed in a *
> ShutdownManager* service which registers as a registry shutdown listener.
>
> Thanks lance, that's a more Tapestrish and cooler way to do it.
>
> *---------------------*
> *Muhammad Gelbana*
> http://www.linkedin.com/in/mgelbana
>
>
> On Mon, Oct 14, 2013 at 5:23 PM, Lance Java <lance.j...@googlemail.com
> >wrote:
>
> > Why not add the following to your database services:
> >
> > @PostInjection
> > public void addShutdownListener(RegistryShutdownHub shutdownHub) {
> >     shutdownHub.addRegistryShutdownListener(new Runnable() { … });
> > }
> >
> > The shutdown listener will only fire if the service has been realized
> > (constructed)
> >
>

Reply via email to