-
1. Re: How to make sure application starts after the management interface
jameslivingston Oct 29, 2015 8:02 PM (in response to edykory)You *really* shouldn't do that, there is a fairly major risk that you will cause a server deadlock.
If you perform a management operation, it could be queued behind any in-progress operations, such as performing a deployment. This means that JBoss may be waiting until the deployment finished, and hence waiting for your @PostConstruct method to complete. If you perform a blocking management operation from such a method, you will then make it wait until the operation completes and it can deadlock. In short, it is not safe to use management API from within any container-managed thread.
What precisely are you doing with the data it returns, and does the EJB absolutely require that information in the @PostConstruct method? You two options are to make it non-blocking (for example start a thread which runs the operation, and not make the method wait for completion) or get the data you need another way.