]
Michael Musgrove updated JBTM-3243:
-----------------------------------
Status: Resolved (was: Pull Request Sent)
Resolution: Done
Use PostConstruct/PreDestroy for ApplicationScoped bean (instead of
Observer)
-----------------------------------------------------------------------------
Key: JBTM-3243
URL:
https://issues.redhat.com/browse/JBTM-3243
Project: JBoss Transaction Manager
Issue Type: Bug
Components: LRA
Affects Versions: 5.10.1.Final
Reporter: Michael Musgrove
Assignee: Michael Musgrove
Priority: Major
Fix For: 5.next
The LRA implementation needs to observe application shutdown in order to perform clean up
activities. It achieves this using an ApplicationScoped bean. But when the destroyed event
is fired a new bean may be created which is not what we want with an application scoped
bean (this behaviour is seen when running as a Quarkus app). Annotating the method with
`@PreDestroy` will ensure the correct application scoped bean used. So instead of
{code}
void disableRecovery(@Observes @Destroyed(ApplicationScoped.class) Object ignore)
{code}
use
{code}
@PreDestroy
void disableRecovery()
{code}