Hi,
I would like to have a graceful shutdown in my standalone Openejb
application.
I have used the following code in my public static void main(String...
args) method
Is it the correct way of doing a graceful shutdown?
--------------------------------------------------
*public static void main(String... a){*
....Some code
* properties.put("openejb.embedded.initialcontext.close", "destroy");*
*final EJBContainer ejbContainer =
EJBContainer.createEJBContainer(properties);
ejbContainer.getContext().bind("inject", this);*
....Some code
* Runtime.getRuntime().addShutdownHook(new Thread() {
@Override public void run() {
LOG.info("Shutting down.."); try
{ ejbContainer.close();
LOG.info("Bye"); } catch (Exception e) {
LOG.error("Graceful shutdown went wrong. SIGKILL
(kill -9) if you want.", e); }
} });*
*Thread.currentThread().join();*
}
--------------------------------------------------
I would like to know is there any benefit of
*properties.put("openejb.embedded.initialcontext.close", "destroy"); *
As I found the value can be either "*destroy*" or "*logout*". Which one is
preferred?