Re: When is PersistentMBean.load() called ?
Roland Huss <[email protected]>
| Newsgroups | gmane.comp.java.mx4j.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Simone,
Bordet, Simone wrote:
>>I could not found *any* reference to PersistentMBean.load()
>>in the source.
>
>
> This is not true, see RMMB.load().
Of course. What I meant, I couldn't find any code *calling* RMMB.load().
So my question is simply at what stage is the persistent state is loaded
back into RMMB. If I understand the specs right, this should be done
transparently by the RMMB itself (see citation in last mail), so load()
need not to be called from the outside.
>>Furthermore, the store() method called in
>>RequiredModelMBean.setAttribute() is only useful, if the "value" field
>>in the AttributeDescriptor is set, which is only the case if some sort
>>of caching is enabled (ALWAYS_STALE == false). Hence, persistence
>>doesn't work at all for write-through scenarios.
>
> Not sure I follow.
> Method store() in RMMB.setAttribute() is called based on the persist
> policy, it seems to me.
Yes, you are right, store() is called according to the persistence
policy. But store() persists the ModelMBeanInfo only:
public void store() throws
BeanException, RuntimeOperationsException,
InstanceNotFoundException
{
PersisterMBean persister = findPersister();
if (persister != null)
{
// Take a clone to avoid synchronization problems
ModelMBeanInfo info = (ModelMBeanInfo)getMBeanInfo();
persister.store(info);
}
So the value of an attribute gets only stored if it is stored within the
ModelMBeanInfo. And an attribute's value is stored only under certain
circumstance with the field 'value' within the ModelMBeanInfo. E.g. if
it is not ALWAYS_STALE (see setAttribute() in RMMB). So by default you
persist only the meta-data but not the current value of the managed
bean's value.
>>Does persistence for mx4j's ModelMBean does work at all or do I miss
>>something ?
>
> I'd double check you're looking at the latest MX4J code.
I looked at the RMMB from the current CVS.
ciao...
--
...roland huss
consol.de
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click