dev@glassfish.java.net

Re: non-compliant AMX MBeans

From: Ken Cavanaugh <Ken.Cavanaugh_at_Sun.COM>
Date: Mon, 29 Jun 2009 13:48:44 -0700
Lloyd Chambers wrote:
OK, thanks.  

Yes, it's fine to register them prior to the parent existing, but once AMX loads, it will want the correct behavior from getParent().

There is a potential race condition:  AMX starts the validation thread as soon as DomainRoot and its immediate children load.

If the parent is an MBean that is not yet registered by the time the validation thread checks, then validation would fail, because the parent would not be found.

Lloyd

But that means that gmbal (or any other SW creating AMX beans) must have registered a child BEFORE it registered the parent,
otherwise how could your validation thread find the child first?  Gmbal should mostly prevent this, because the only way to register is as
follows:
I suppose it MIGHT be possible to do something like

DomainRoot -> gmbalroot -> gmbal children

and have a situation where DomainRoot and gmbalroot are BOTH managed outside of Gmbal, in which case
gmbal won't prevent the problem, and it might be possible to register gmbalroot before DomainRoot.  But I suspect
this case should go through utilities that you control, which would prevent this.

Ken.