I'm migrating a WAR application from PayaraServer to Payara Micro to reduce RAM usage.
I just realise that @PreDestroy on EJBs are not called when stopping the instance with CTRL+C.
Is there a correct way to close the payaramicro instance properly as I'd like to execute some operations.
Thanks for your answers!
Or which services in Payara Server to deactivate to use as much as RAM as PayaraMicro?
I'm using the version 5.183, and I also tried the 5.192.
Which kind of EJB did you use? In my opinion it should work on
@Singletonand@Stateless. I am not sure how the other EJBs are supported by Payara Micro.However, since Payara Micro supports the Java EE Web Profile and you are using a web application anyway, I would suggest to use a
@WebListenerto get notified of lifecycle events.It could be implemented as follows:
Simply add this class to your WAR file then.