users@jsr311.java.net

Re: Application class

From: Eli Doran <eli_at_elidoran.com>
Date: Thu, 11 Feb 2010 22:40:35 -0500

Thank you for the info Paul.

All I want is *someone* to tell my Application subclass it's life is over.

I deployed a simple app to google app engine and the PostConstruct
annotation works. I'm sure the ManagedBean is unsupported, but, it seems I
can get the construct annotation to work without that. Without taking a look
at the code I assume it is my use of Jersey's ServletContainer providing
that for my Application class.

I'm still looking for a way to *test* that the PreDestroy annotated method
will run. I believe it makes sense that if PostConstruct works, the
PreDestroy will to. However, I'd still like to see that in the logs, ya
know? :) I had assumed that shutting down Jetty would go through the
destroy motions. I'll be looking at the servlet's destroy() next to
determine if it gets called, and go from there.

Thank you :)
~ Eli

On Thu, Feb 11, 2010 at 5:55 AM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:

>
> On Feb 10, 2010, at 8:46 PM, Eli Doran wrote:
>
> Thank you for showing me the way. :)
>>
>> Is the 'ManagedBean' annotation supposed to be necessary?
>>
>
> Yes, for portable JAX-RS applications.
>
> Note that GAE is not EE 6 compliant so that annotation will not work. For
> the annotation to work you need to deploy to an EE 6 compliant application
> server.
>
>
>
> I used both PostConstruct and PreDestroy, without the ManagedBean
>> annotation, in an Application subclass passed to Jersey servlet, on Jetty 7
>> and app engine 1.3 (local machine) and the PostConstruct annotated method
>> runs fine.
>>
>
> Yes, that is an implementation specific feature.
>
>
>
> (I haven't figured out how to test that the PreDestroy is working for
>> sure. When I terminate the server via console or eclipse that's the end of
>> it. No more info written to log file either.)
>>
>>
> PreDestroy should also work.
>
>
>
> Is it *odd* that those implementations honor those annotations without the
>> 'ManagedBean' on the Application subclass?
>>
>>
> Not really :-) if you are deploying to a non-EE-compliant platform such a
> features is useful.
>
>
> Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>
>