[jboss-as7-dev] Help on service controller lifecycles

Jeff Mesnil jmesnil at redhat.com
Thu Mar 22 10:30:38 EDT 2012


Hi guys,

there are intermittent failures when updating a connection factory 
attributes in messaging subsystem[1] and I tracked it down to a problem 
of service states

To make a story short, when we update a connection factory, we recreate 
its JNDI binding by doing a unbind() followed by a bind() on the 
AS7BindingRegistry[2].
To bind a CF, we install a BindingService into the controller and set 
its mode to ACTIVE.
To unbind a CF, we set its ServiceController's mode to REMOVE.

However, it occurs that when doing a unbind() followed by a bind(),
we may try to install a BindingService when it is not uninstalled yet 
(it's in the DOWN/REMOVING) state (removing the Thread.sleep() in [3] to 
highlight the issue)

I fix the issue locally by checking in bind() whether the service 
controller exists and if it is DOWN/REMOVING wait until it is REMOVED.
But I don't like sleeping until a service controller state changes. I am 
sure there is a more idiomatic/elegant way to do this.
Does someone have pointers to show me the best way to do this?


thanks,
jeff

[1] https://issues.jboss.org/browse/JBPAPP-8184
[2] 
https://github.com/jmesnil/jboss-as/blob/JBPAPP-8184_connection_factory_failure/messaging/src/main/java/org/jboss/as/messaging/jms/AS7BindingRegistry.java
[3] 
https://github.com/jmesnil/jboss-as/blob/JBPAPP-8184_connection_factory_failure/messaging/src/test/java/org/jboss/as/messaging/test/AS7BindingRegistryTestCase.java

-- 
Jeff Mesnil
JBoss, a division of Red Hat
http://jmesnil.net/


More information about the jboss-as7-dev mailing list