Why dont you make your mbean depend on the Tomcat MBean. That way, your mbean will not be invoked till tomcat is started.. the tomcat mbean is
the situation is little bit complicated. I actually have MBean that have to make connection to servlet ... never mind what. But Tomcat connectors are started after jboss is started. My MBean waits for this too to make the connection. So if i try to :
URL url = new URL(urlString);
after i get "org.jboss.system.server.started" notification then i will wait for stream, tomcat will wait for notification and deadlock occurs. Thats why i need notification on Tomcat.
So you mean, depending on the order you receive "org.jboss.system.server.started" (i.e. if you receive this first from the tomcat connector) you are in a dealock?
Yes, deadlock occurs. And I am looking for an elegant resolve for this problem.
This has been solved in the next releases (3.2.8/4.0.2) with the introduction of a new notification "jboss.tomcat.connectors.started":
To get the event, ala NotificationListenerSupport you can use:
... <attribute name="SubscriptionList"> <subscription-list> <mbean name="jboss.web:service=WebServer"> <filter factory="NotificationFilterSupportFactory"> <enable type="jboss.tomcat.connectors.started"/> </filter> </mbean> </subscription-list> </attribute> ...