Here's an open issue that I've not seen discussed: what happens when a
'key' value changes?
In Glassfish v2, there was no direct way to change any key value; one
had to edit domain.xml manually, and or remove/re-add.
In Glassfish v3, there is nothing to prevent a key value from being
changed at runtime, since it has both a getter and setter.
......
When an @Configured has an @Attribute(key=true), is there any
restriction on changing its value?
In most cases, this seems benign to the user of that item, since the
name itself probably serves only as a unique identifier.
But there are downstream ramifications. For example, if AMX MBeans
are in use, the ObjectName incorporates that key value into the
ObjectName (this feature is what allows navigating MBean ObjectNames
as a hierarchy).
If a key value changes, than the corresponding MBean and its entire
sub-tree of MBeans must be unregistered and re-registered in order to
make the ObjectNames match the new value.
Take a very simplest case of a leaf node, a <property> inside <domain>:
<property name="test", value="test">
amx:j2eeType=X-PropertyConfig,name=test
If "name" is changed to "test1", then the ObjectName must become:
amx:j2eeType=X-PropertyConfig,name=test1
...
A more complex case is changing the name of an ancestor. For example,
a <config name="config1" ...> might have several hundred or several
thousand children*, each incorporating the value "config1" into the
ObjectName.
Lloyd
..............................................
Lloyd Chambers
lloyd.chambers_at_sun.com
GlassFish team, LSARC member