Help on service controller lifecycles

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help on service controller lifecycles

Jeff Mesnil
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/
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help on service controller lifecycles

jtgreene
Administrator
Hi Jeff,

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.

On 3/22/12 9:30 AM, Jeff Mesnil wrote:

> 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
>


--
Jason T. Greene
JBoss AS Lead / EAP Platform Architect
JBoss, a division of Red Hat
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev