When using keep the following points in mind of lifecycle module:
The server lifecycle listener classes are called synchronously from the main server thread. Therefore, take extra precautions must be taken to ensure that the listener classes don't block the server.
The listener classes may create threads if appropriate. The threads must be stopped during the shutdown and termination phases.
The resources allocated during initialization or startup events should be cleared.
The listener classes are loaded in the context of server's root class loader, which loads server-wide resources as well. Therefore, all the support classes needed by these server lifecycle event listener must be available at this class loader or its parent, the system class loader. As a consequence, you must ensure that the Java security manager policy files are appropriately set up, Otherwise, a lifecycle listener class trying to perform a System.exec()may get a security access violation.