I've been looking for a way to programmatically let a deployment stop itself.
For our use case we deploy several ear's, where one is the most important one, and the others depend on it. We made certain that the important ear deploys first, and the others start deploying in parallel afterwards.
The problem we are facing is that the important ear can be in upgrade mode, which is valid.
In the ear's that start afterwards we check for the runmode, and when it is not normal, we throw a RuntimeException. The checking for every ear deployment, happens in a Singleton Startup EJB3 Bean. But when these throw a RuntimeException the deployment is still active. I would like to inform the container that the deployment should be marked as failed. Is something like this possible?
The technologies we are using are: Wildfly 10, Java-ee 7, EJB3.
I found a solution on stackoverflow which uses the commandline CLI to stop a deployment. Can a deployment stop itself? It seems to me that it should be possible to do this in the source code itself.
Any thoughts?