I think your problem is the JBoss implementation of JMX. According to JSR160, specifying persistPolicy=OnUpdate
for an attribute should result in persisting every time the attribute is updated (from JSR160 1.4):
persistPolicy – Defines the default persistence policy for attributes in this MBean
that do not define their own persistPolicy. Takes on one of the following values:[…]
- OnUpdate – The attribute is stored every time the attribute is updated.
It is most likely caused by this very strange text in Sun’s Javadoc for PersistMBean
(as pointed out by @Plínio Pantaleão):
Do not store the MBean if ‘persistPolicy’ field is:
= “never”
= “onUpdate”
= “onTimer” && now < ‘lastPersistTime’ + ‘persistPeriod’
Other than reporting this to JBoss (and the Javadoc issue to Sun), you may be able to work around it by using persistPolicy=Always
policy (again, from JSR160):
- Always – This is a synonym of OnUpdate, which is recognized for
compatibility reasons. It is recommended that applications use OnUpdate
instead. An implementation of the Descriptor interface, such as
DescriptorSupport, can choose to replace a value of “Always” for
persistPolicy by a value of “OnUpdate”.