That's great Howard !

I also have some thoughts about this situation. I asked a similar question
before and this is one of replies I got:
http://mail-archives.apache.org/mod_mbox/tapestry-users/201110.mbox/%3Cop.v2wetk2d18r83n@lhost.localdomain%3E

Thiago is suggesting to use the method:

public static void contributeRegistryStartup(OrderedConfiguration<Runnable>)
{} (Explained here:
http://tapestry.apache.org/registry-startup.html)


So if we register our services as a registry shutdown listeners and now that
we know in what order will they be registered. Wouldn't this mean that they
will also shutdown in a known order ?

Check these 2 classes source code to know what I mean exactly:

org.apache.tapestry5.ioc.internal.services.RegistryShutdownHubImpl


Also note that the listeners list is implemented in a custom way by
tapestry:

java.util.concurrent.CopyOnWriteArrayList<E>


Kindly tell If I misinterpreted something.

On Sat, Oct 15, 2011 at 5:57 AM, Steve Eynon <steve.ey...@alienfactory.co.uk
> wrote:

> Oh, nice one!
>
> Cheers!
>
>
> On 15 October 2011 05:51, Howard Lewis Ship <hls...@gmail.com> wrote:
> > I'm about to commit changes to allow for registry "will" shutdown
> notifications.
> >
> > On Fri, Oct 14, 2011 at 1:20 PM, Tony Nelson <tnel...@starpoint.com>
> wrote:
> >> I have a bunch of threads that I've spawned off that I'd like to shut
> down gracefully.
> >>
> >> On Oct 14, 2011, at 4:14 PM, Steve Eynon wrote:
> >>
> >>> Alas no, there is no other method (I'm aware of) that lets you know
> >>> the registry is "about to shutdown", just the one that tells you it's
> >>> in the process of.
> >>>
> >>> There have been a couple of situations when I wished there was though!
> >>> (e.g. to log the shutdown event to a database.)
> >>>
> >>> Steve.
> >>>
> >>> On 15 October 2011 03:51, Tony Nelson <tnel...@starpoint.com> wrote:
> >>>> I have successfully registered a shutdown listener as described in the
> document ion.  It seems that registryDidShutdown() is called after the
> registry is done shutting down and I no longer have access to any of the
> services the registry previously held.  Is there another method I can use to
> be notified just before the registry is shut down?  The exception I'm seeing
> is this:
> >>>>
> >>>> [ERROR] TapestryIOCModule.RegistryShutdownHub Error notifying
> com.starpoint.instihire.services.AppModule$ThreadShutdownListener@54030e7bof 
> registry shutdown: Exception constructing service 'EmailQueue': Proxy for
> service EmailQueue is no longer active because the IOC Registry has been
> shut down.
> >>>> java.lang.RuntimeException: Exception constructing service
> 'EmailQueue': Proxy for service EmailQueue is no longer active because the
> IOC Registry has been shut down.
> >>>>        at
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:78)
> >>>>        at
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:56)
> >>>>        at $InstiHireQueue_124caf428070f755.delegate(Unknown Source)
> >>>>        at $InstiHireQueue_124caf428070f755.getQueueReader(Unknown
> Source)
> >>>>        at
> com.starpoint.instihire.services.AppModule$ThreadShutdownListener.registryDidShutdown(AppModule.java:292)
> >>>>        at
> org.apache.tapestry5.ioc.internal.services.RegistryShutdownHubImpl.fireRegistryDidShutdown(RegistryShutdownHubImpl.java:57)
> >>>>        at
> org.apache.tapestry5.ioc.internal.RegistryImpl.shutdown(RegistryImpl.java:384)
> >>>>        at
> org.apache.tapestry5.ioc.internal.RegistryWrapper.shutdown(RegistryWrapper.java:41)
> >>>>        at
> org.apache.tapestry5.TapestryFilter.destroy(TapestryFilter.java:192)
> >>>>        at
> org.mortbay.jetty.servlet.FilterHolder.destroyInstance(FilterHolder.java:127)
> >>>>        at
> org.mortbay.jetty.servlet.FilterHolder.doStop(FilterHolder.java:107)
> >>>>        at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:76)
> >>>>        at
> org.mortbay.jetty.servlet.ServletHandler.doStop(ServletHandler.java:176)
> >>>>        at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:76)
> >>>>        at
> org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142)
> >>>>        at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:76)
> >>>>        at
> org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142)
> >>>>        at
> org.mortbay.jetty.servlet.SessionHandler.doStop(SessionHandler.java:125)
> >>>>        at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:76)
> >>>>        at
> org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142)
> >>>>        at
> org.mortbay.jetty.handler.ContextHandler.doStop(ContextHandler.java:592)
> >>>>        at
> org.mortbay.jetty.webapp.WebAppContext.doStop(WebAppContext.java:537)
> >>>>        at
> org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStop(Jetty6PluginWebAppContext.java:123)
> >>>>        at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:76)
> >>>>        at
> org.mortbay.jetty.handler.HandlerCollection.doStop(HandlerCollection.java:169)
> >>>>        at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:76)
> >>>>        at
> org.mortbay.jetty.handler.HandlerCollection.doStop(HandlerCollection.java:169)
> >>>>        at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:76)
> >>>>        at
> org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142)
> >>>>        at org.mortbay.jetty.Server.doStop(Server.java:283)
> >>>>        at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:76)
> >>>>        at
> org.mortbay.jetty.Server$ShutdownHookThread.run(Server.java:561)
> >>>> Caused by: java.lang.IllegalStateException: Proxy for service
> EmailQueue is no longer active because the IOC Registry has been shut down.
> >>>>        at
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator$1.createObject(JustInTimeObjectCreator.java:101)
> >>>>        at
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68)
> >>>>        ... 31 more
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> Thanks in advance
> >>>> Tony Nelson
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >>>> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>>>
> >>>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >>> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>
> >>
> >
> >
> >
> > --
> > Howard M. Lewis Ship
> >
> > Creator of Apache Tapestry
> >
> > The source for Tapestry training, mentoring and support. Contact me to
> > learn how I can get you up and productive in Tapestry fast!
> >
> > (971) 678-5210
> > http://howardlewisship.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
*Regards,*
*Muhammad Gelbana
Java Developer*

Reply via email to