@Barry, there are usually tests being carried out killing the server will
leave the database in an inconsistent state. So a graceful shutdown is
needed

@Lance, you are correct, this is a good approach to solve this.

I still think having this around (Checking if a service is built) is an
addition that wouldn't hurt, but will rather offer an extra feature.

*---------------------*
*Muhammad Gelbana*
http://www.linkedin.com/in/mgelbana


On Mon, Oct 14, 2013 at 8:56 PM, Lance Java <lance.j...@googlemail.com>wrote:

> 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