Jean Deruelle wrote:
It seems that in the FieldBasedClusteredSession class, the
setJBossInternalAttribute method (which is called by setAttribute) put
the object in the cache and then add Obervers to check for potentials
changes in the attributes of the object and if so set the session as
dirty so that on transaction commit it is replicated,
So I was thinking to do the same at cache level, when the put is done
add the observers and jbosscache takes care of the changes in the object
and replicate if needed on transaction commit. But it seems that the
Observers can only be added on an AOPized object, so I still wonder why
this is needed to add those observers in the FieldBasedClusteredSession
if the object is already AOPized and not let JbossCache handle the
replication process automatically...?
The only thing AOPized is the attribute value. The session itself
isn't. The Observer impl generates a callback to the session so it knows
it's dirty and can replicate session metadata (e.g. access timestamps,
an access counter, etc).
Note that in AS 5 I'm aiming to get rid of this Observer usage. If
changing the location where pojos is stored can work (see
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=134386) then a
simple JBC CacheListener can serve the same function. Even if not, I
may be able to get rid of it and just rely on some new stuff that
ensures the timestamp is replicated at least once a minute.
--
Brian Stansberry
Lead, AS Clustering
JBoss, a division of Red Hat
brian.stansberry(a)redhat.com