[jboss-cvs] JBossCache/src/org/jboss/cache/pojo/impl ...
Jason Thomas Greene
jgreene at jboss.com
Thu May 31 22:02:25 EDT 2007
User: jgreene
Date: 07/05/31 22:02:25
Modified: src/org/jboss/cache/pojo/impl AdvisedPojoHandler.java
Log:
Apply JBCACHE-1078 (Contributed by Vincent Marques)
Revision Changes Path
1.7 +8 -6 JBossCache/src/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AdvisedPojoHandler.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- AdvisedPojoHandler.java 30 May 2007 06:08:01 -0000 1.6
+++ AdvisedPojoHandler.java 1 Jun 2007 02:02:25 -0000 1.7
@@ -32,7 +32,7 @@
*
* @author Ben Wang
* Date: Aug 4, 2005
- * @version $Id: AdvisedPojoHandler.java,v 1.6 2007/05/30 06:08:01 jgreene Exp $
+ * @version $Id: AdvisedPojoHandler.java,v 1.7 2007/06/01 02:02:25 jgreene Exp $
*/
class AdvisedPojoHandler
{
@@ -115,11 +115,6 @@
Map map = new HashMap();
// Always initialize the ref count so we can mark this as an AopNode.
PojoInstance pojoInstance = InternalHelper.initializeAopInstance(referencingFqn);
- // Insert interceptor at runtime
- CacheFieldInterceptor interceptor = new CacheFieldInterceptor(pCache_, fqn, type);
- interceptor.setAopInstance(pojoInstance);
- util_.attachInterceptor(obj, advisor, interceptor);
-
map.put(PojoInstance.KEY, pojoInstance);
pojoInstance.setPojoClass(type.getType());
// we will do it recursively.
@@ -172,6 +167,13 @@
// cache_.getInvocationContext().getOptionOverrides().setSuppressLocking(true);
cache_.getRoot().addChild(fqn).putAll(map);
+
+ // Insert interceptor after PojoInstance has been written to the cache
+ // This prevents JBCACHE-1078 with pessimistic locking, optimistic is still a problem
+ CacheFieldInterceptor interceptor = new CacheFieldInterceptor(pCache_, fqn, type);
+ interceptor.setAopInstance(pojoInstance);
+ util_.attachInterceptor(obj, advisor, interceptor);
+
// cache_.getInvocationContext().getOptionOverrides().setSuppressLocking(false);
// This is in-memory operation only
InternalHelper.setPojo(pojoInstance, obj);
More information about the jboss-cvs-commits
mailing list