Thank you for showing me the way. :)
Is the 'ManagedBean' annotation supposed to be necessary? 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. (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.)
Is it *odd* that those implementations honor those annotations without the
'ManagedBean' on the Application subclass?
~ Eli
On Wed, Feb 10, 2010 at 6:08 AM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>
> On Feb 9, 2010, at 7:19 PM, Marc Hadley wrote:
>
> On Feb 9, 2010, at 1:00 PM, Eli Doran wrote:
>>
>> The Application class as a bridge between an app and the server managing
>>> things is very helpful.
>>> It seems to be missing one thing though ... It isn't told when it's time
>>> to *destroy* the application.
>>> Some of the singletons returned by Application#getSingletons() may need
>>> special attention at 'destroy' time.
>>> What's the expected implementation for handling that situation with the
>>> current version?
>>> It seems to me I can't simply pass an Application subclass to the server.
>>> I have to make a filter, servlet, or listener which will be notified of
>>> 'destroy' time.
>>>
>>> In short:
>>> The "Application" javadoc states "Defines the components of a JAX-RS
>>> application and supplies additional metadata."
>>> After it provides the components to the server a reciprocal action to
>>> signify the server is done with them would be great.
>>>
>>> What do you think?
>>>
>>> In a container that supports managed beans (EE6, JSR 299) you can make
>> the Application class a managed bean and then use the @PreDestroy annotation
>> to get what you want.
>>
>>
> Yes,
>
> @ManagedBean
> public MyApp extends Application {
> @PreDestroy
> public void destroy() { ... }
> }
>
> Paul.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>
>