there are intermittent failures when updating a connection factory
attributes in messaging subsystem 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
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  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?
Let's chat about this on IRC. The right way to do this is at a service
level is with a listener, however the facility we mainly intend everyone
to use in the context of a management operation is the
ctx.removeService() call. So seems like we have an API pass through
issue to figure out.