Well, JBoss uses services (MBeans) and deployment ordering. Deployers also emit notification (via JMX) when a service is added or removed.
Maybe you should buy one of those expensive books if the google.com is too complicated?
Sorry, I didn't want to be sarcastic. I'm just a bit lost: Your query points me directly to the Wiki page ReceiveJMXDeploymentNotifications. That's where I started a couple of days before. I deploy a JMX based NotificationListener in an SAR registering with the EARDeployer. And it works fine for deployment. But on undeployment, I receive the notification too late. My EJBs are already undeployed at that time. However, I need to perform some pre-undeploy actions with by EJBs still active. This excactly is the problem. And even in the books - I bought all the three of them - I cannot find a hint how to make it.