You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Muhammad Gelbana <m....@gmail.com> on 2013/04/03 22:27:43 UTC

Registry will shutdown listener not invoked

I use tapestry to develop windows services so this should be similar to a
desktop application I suppose and it's no where close to a web application.

This method is supposed to register a registryWillShutdownListener

@Startup
public void startup(RegistryShutdownHub registryShutdown, @IpK final
IMonitoredConfigurationSource ipkConfig, final Logger log) {
    log.info(registryShutdown); // This is called
    registryShutdown.addRegistryWillShutdownListener(new Runnable() {
        @Override
        public void run() {
            log.warn("Announcing shutdown"); // This whole method as if it
doesn't exist !
            ipkConfig.shutdown();
            log.warn("IpkConfig: " + ipkConfig.isShuttingDown());
        }
    });
}

What is really strange is that *there are other modules being contributed
just like this one and their shutdown listeners act as expected*, except
for this module ! In addition to the first logging call being actually
invoked and I can see it's output in the log files, I can also see the
module contribution message by tapestry so this module is definitely being
loaded, I just don't know why isn't this listener being invoked.

Are their any other precaution I should consider for my shutdown listeners
to surely work ?

Thank you.

Re: Registry will shutdown listener not invoked

Posted by Muhammad Gelbana <m....@gmail.com>.
That was it ! Shutdown listener runnables aren't threaded when called. I
know the interface Runnable isn't obligated to be executed withing threads
but I guess since tapestry honors coding through convention, a clear
heads-up for this behavior would be great in the docs. Unless I missed it !

Thanks to all who tried to help :)


On Thu, Apr 4, 2013 at 7:28 PM, Muhammad Gelbana <m....@gmail.com>wrote:

> I've been thinking I may know the reason for what I'm facing but to make
> sure I need to confirm something after looking into this piece of code:
>
>
> org.apache.tapestry5.ioc.internal.services.RegistryShutdownHubImpl.fireRegistryDidShutdown()
>
> This method calls the shutdown listeners one after another, correct ? not
> in a threaded way...
>
> Could someone from the dev team confirm that ? Thanks
>
>
> On Wed, Apr 3, 2013 at 10:39 PM, Muhammad Gelbana <m....@gmail.com>wrote:
>
>> addRegistryWillShutdownListener<http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/services/RegistryShutdownHub.html#addRegistryWillShutdownListener(java.lang.Runnable)> is
>> used to contribute methods to be invoked right before proxies\registry are
>> destroyed
>>
>>
>> On Wed, Apr 3, 2013 at 10:32 PM, Michael Prescott <
>> michael.r.prescott@gmail.com> wrote:
>>
>>> What is 'log', is it an injected logger service?  Once shutdown has
>>> started, other services may already have been deactivated, so those calls
>>> may fail.
>>>
>>>
>>> On 3 April 2013 16:27, Muhammad Gelbana <m....@gmail.com> wrote:
>>>
>>> > I use tapestry to develop windows services so this should be similar
>>> to a
>>> > desktop application I suppose and it's no where close to a web
>>> application.
>>> >
>>> > This method is supposed to register a registryWillShutdownListener
>>> >
>>> > @Startup
>>> > public void startup(RegistryShutdownHub registryShutdown, @IpK final
>>> > IMonitoredConfigurationSource ipkConfig, final Logger log) {
>>> >     log.info(registryShutdown); // This is called
>>> >     registryShutdown.addRegistryWillShutdownListener(new Runnable() {
>>> >         @Override
>>> >         public void run() {
>>> >             log.warn("Announcing shutdown"); // This whole method as
>>> if it
>>> > doesn't exist !
>>> >             ipkConfig.shutdown();
>>> >             log.warn("IpkConfig: " + ipkConfig.isShuttingDown());
>>> >         }
>>> >     });
>>> > }
>>> >
>>> > What is really strange is that *there are other modules being
>>> contributed
>>> > just like this one and their shutdown listeners act as expected*,
>>> except
>>> > for this module ! In addition to the first logging call being actually
>>> > invoked and I can see it's output in the log files, I can also see the
>>> > module contribution message by tapestry so this module is definitely
>>> being
>>> > loaded, I just don't know why isn't this listener being invoked.
>>> >
>>> > Are their any other precaution I should consider for my shutdown
>>> listeners
>>> > to surely work ?
>>> >
>>> > Thank you.
>>> >
>>>
>>
>>
>

Re: Registry will shutdown listener not invoked

Posted by Muhammad Gelbana <m....@gmail.com>.
I've been thinking I may know the reason for what I'm facing but to make
sure I need to confirm something after looking into this piece of code:

org.apache.tapestry5.ioc.internal.services.RegistryShutdownHubImpl.fireRegistryDidShutdown()

This method calls the shutdown listeners one after another, correct ? not
in a threaded way...

Could someone from the dev team confirm that ? Thanks


On Wed, Apr 3, 2013 at 10:39 PM, Muhammad Gelbana <m....@gmail.com>wrote:

> addRegistryWillShutdownListener<http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/services/RegistryShutdownHub.html#addRegistryWillShutdownListener(java.lang.Runnable)> is
> used to contribute methods to be invoked right before proxies\registry are
> destroyed
>
>
> On Wed, Apr 3, 2013 at 10:32 PM, Michael Prescott <
> michael.r.prescott@gmail.com> wrote:
>
>> What is 'log', is it an injected logger service?  Once shutdown has
>> started, other services may already have been deactivated, so those calls
>> may fail.
>>
>>
>> On 3 April 2013 16:27, Muhammad Gelbana <m....@gmail.com> wrote:
>>
>> > I use tapestry to develop windows services so this should be similar to
>> a
>> > desktop application I suppose and it's no where close to a web
>> application.
>> >
>> > This method is supposed to register a registryWillShutdownListener
>> >
>> > @Startup
>> > public void startup(RegistryShutdownHub registryShutdown, @IpK final
>> > IMonitoredConfigurationSource ipkConfig, final Logger log) {
>> >     log.info(registryShutdown); // This is called
>> >     registryShutdown.addRegistryWillShutdownListener(new Runnable() {
>> >         @Override
>> >         public void run() {
>> >             log.warn("Announcing shutdown"); // This whole method as if
>> it
>> > doesn't exist !
>> >             ipkConfig.shutdown();
>> >             log.warn("IpkConfig: " + ipkConfig.isShuttingDown());
>> >         }
>> >     });
>> > }
>> >
>> > What is really strange is that *there are other modules being
>> contributed
>> > just like this one and their shutdown listeners act as expected*, except
>> > for this module ! In addition to the first logging call being actually
>> > invoked and I can see it's output in the log files, I can also see the
>> > module contribution message by tapestry so this module is definitely
>> being
>> > loaded, I just don't know why isn't this listener being invoked.
>> >
>> > Are their any other precaution I should consider for my shutdown
>> listeners
>> > to surely work ?
>> >
>> > Thank you.
>> >
>>
>
>

Re: Registry will shutdown listener not invoked

Posted by Muhammad Gelbana <m....@gmail.com>.
addRegistryWillShutdownListener<http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/services/RegistryShutdownHub.html#addRegistryWillShutdownListener(java.lang.Runnable)>
is
used to contribute methods to be invoked right before proxies\registry are
destroyed


On Wed, Apr 3, 2013 at 10:32 PM, Michael Prescott <
michael.r.prescott@gmail.com> wrote:

> What is 'log', is it an injected logger service?  Once shutdown has
> started, other services may already have been deactivated, so those calls
> may fail.
>
>
> On 3 April 2013 16:27, Muhammad Gelbana <m....@gmail.com> wrote:
>
> > I use tapestry to develop windows services so this should be similar to a
> > desktop application I suppose and it's no where close to a web
> application.
> >
> > This method is supposed to register a registryWillShutdownListener
> >
> > @Startup
> > public void startup(RegistryShutdownHub registryShutdown, @IpK final
> > IMonitoredConfigurationSource ipkConfig, final Logger log) {
> >     log.info(registryShutdown); // This is called
> >     registryShutdown.addRegistryWillShutdownListener(new Runnable() {
> >         @Override
> >         public void run() {
> >             log.warn("Announcing shutdown"); // This whole method as if
> it
> > doesn't exist !
> >             ipkConfig.shutdown();
> >             log.warn("IpkConfig: " + ipkConfig.isShuttingDown());
> >         }
> >     });
> > }
> >
> > What is really strange is that *there are other modules being contributed
> > just like this one and their shutdown listeners act as expected*, except
> > for this module ! In addition to the first logging call being actually
> > invoked and I can see it's output in the log files, I can also see the
> > module contribution message by tapestry so this module is definitely
> being
> > loaded, I just don't know why isn't this listener being invoked.
> >
> > Are their any other precaution I should consider for my shutdown
> listeners
> > to surely work ?
> >
> > Thank you.
> >
>

Re: Registry will shutdown listener not invoked

Posted by Michael Prescott <mi...@gmail.com>.
What is 'log', is it an injected logger service?  Once shutdown has
started, other services may already have been deactivated, so those calls
may fail.


On 3 April 2013 16:27, Muhammad Gelbana <m....@gmail.com> wrote:

> I use tapestry to develop windows services so this should be similar to a
> desktop application I suppose and it's no where close to a web application.
>
> This method is supposed to register a registryWillShutdownListener
>
> @Startup
> public void startup(RegistryShutdownHub registryShutdown, @IpK final
> IMonitoredConfigurationSource ipkConfig, final Logger log) {
>     log.info(registryShutdown); // This is called
>     registryShutdown.addRegistryWillShutdownListener(new Runnable() {
>         @Override
>         public void run() {
>             log.warn("Announcing shutdown"); // This whole method as if it
> doesn't exist !
>             ipkConfig.shutdown();
>             log.warn("IpkConfig: " + ipkConfig.isShuttingDown());
>         }
>     });
> }
>
> What is really strange is that *there are other modules being contributed
> just like this one and their shutdown listeners act as expected*, except
> for this module ! In addition to the first logging call being actually
> invoked and I can see it's output in the log files, I can also see the
> module contribution message by tapestry so this module is definitely being
> loaded, I just don't know why isn't this listener being invoked.
>
> Are their any other precaution I should consider for my shutdown listeners
> to surely work ?
>
> Thank you.
>