tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: CDI @Observes ApplicationScoped.class
Date Mon, 29 May 2017 09:12:52 GMT
2017-05-29 10:56 GMT+02:00 tonywestonuk <tonyw@totspics.com>:

> Does it?
>
> The events are the same...  (Both 2010426450)
>

yes, in case of a way you can put state in the ServletContext


>
> HOWEVER,
> There are 2 separate instances of Listener (ref 35419258 and 420676924),
> even though Listener class is annotated with @ApplicationScoped
>
>
> So, the end method, will not be able to access the instance variables
> created in start.
>
> Is this really the way it should be?  If so, I'll have to use static
> variables.
>

It is as it should be since the spec requires the @Destroyed event to be
fired after the context destruction (got clarified in 2.0 work which added
a @BeforeDestroyed one)

However as said before you don't need to use static variables since you
have @PreDestroy which is a natural fit


>
>
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/CDI-Observes-ApplicationScoped-class-tp4681766p4681772.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message