I'm currently searching for a way to stop a deployment on wildfly programmatically.
Background:
- The application does some health checks in its startup phase using an MBean.
- If the app determines that the environment is not valid because some resources are missing, it needs to stop its own deployment.
The way it was:
- The application was formerly running on JBoss 4 and simply stopped the whole app server calling the shutdown command using JMX.
- In case this command failed, it simply terminated the whole JVM using System.exit(1).
Current problems:
- Calling shutdown() via JMX does not work on wildfly since the whole server hangs when trying to stop it from within a deployed application.
- System.exit() will also not work since wildly must be catching the command in any way.
So does anyone know how to stop the server from within the deployment or stop the deployment process or undeploy the app?
Thanks a lot!