-
1. Re: JBossCacheAOP synchronization of local variables
ben.wang Nov 10, 2005 10:32 PM (in response to mikeg123)1. Have you got JBoss Aop to work under 3.2.6?
2. What version of JBossCache you are using?
-Ben -
2. Re: JBossCacheAOP synchronization of local variables
mikeg123 Nov 11, 2005 8:19 AM (in response to mikeg123)Hi,
yes, AOP works fine for other stuff under 3.2.6
jboss-aop_1.1.2
JBossCache-1.2.4
but in my case I'm not defining anything in jboss-aop.xml for the caching stuff because I'm adding Map directly to the cache (see previous post) -
3. Re: JBossCacheAOP synchronization of local variables
ben.wang Nov 15, 2005 1:04 AM (in response to mikeg123)OK, by using the proxy, we are not updating the original reference now. So my question is: can you just simply replace localSessionMap with proxySessionMap?
Otherwise, we will need to open a Jira issue that needs to be fixed in the next release.
-Ben -
4. Re: JBossCacheAOP synchronization of local variables
mikeg123 Nov 15, 2005 9:55 AM (in response to mikeg123)Hello,
I actually do use proxy for most of the operation, except in some cases I have to iterate over the map values and the proxy version is not clonable. of course I could copy values from proxy to local, clone, iterate and then synch again, but it seems a litte counter intuative because as I understand if you put an instance of a class that references a map into cache then I can directly manipulate the map itself and both local and proxy copy would be synched, correct? -
5. Re: JBossCacheAOP synchronization of local variables
ben.wang Nov 17, 2005 12:24 AM (in response to mikeg123)No, because we can't instrument the local version so anything you do on the local version is not intercepted. However, the other way can be true though provided we keep the original reference. But keeping the original reference may not be strightforward. That is, in this case, we will have a local Map, a proxy map, and also indexed value from cache.
It can be done but I have to think about it. Here is the Jira:
http://jira.jboss.com/jira/browse/JBCACHE-354 -
6. Re: JBossCacheAOP synchronization of local variables
mikeg123 Nov 17, 2005 10:24 AM (in response to mikeg123)ok, I see.
so in the example from TreeCacheAOP guide
Person joe = new Person();
joe.setName("Joe Black"); // This is base class attributes
ArrayList lang = new ArrayList();
lang.add("English");
lang.add("Mandarin");
joe.setLanguages(lang);
// This will map the languages List automatically and swap it out
with the proxy reference.
tree.putObject("/aop/student/joe", joe);
ArrayList lang = joe.getLanguages(); // Note that lang is a
proxy reference
lang.add("French"); // This will be intercepted by the cache
local to joe "lang" would not be in synch with the proxy
(local would have values: English, Mandaring and
proxy would have values: English, Mandaring, French)? (which might be a little wacky)
but what about if "setLanguages" method was defined as "prepare"
for interception, so if I called something like
joe.setLanguages("Spanish"),
would it intercept and update the proxy copy as well and not the local? -
7. Re: JBossCacheAOP synchronization of local variables
ben.wang Nov 17, 2005 7:03 PM (in response to mikeg123)Yes, it would update the proxy copy because TreeCacheAop has swapped out the local copy with the proxy one.
-Ben