[jboss-cvs] JBossCache/src/org/jboss/cache/aop ...
Ben Wang
bwang at jboss.com
Wed Oct 25 10:12:59 EDT 2006
User: bwang
Date: 06/10/25 10:12:59
Modified: src/org/jboss/cache/aop Tag: Branch_JBossCache_1_4_0
AOPInstance.java InternalDelegate.java
TreeCacheAopDelegate.java
Log:
JBCACHE-763 proper rollback for Collection
Revision Changes Path
No revision
No revision
1.12.2.1 +9 -0 JBossCache/src/org/jboss/cache/aop/AOPInstance.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AOPInstance.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/aop/AOPInstance.java,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -u -b -r1.12 -r1.12.2.1
--- AOPInstance.java 9 May 2006 02:18:56 -0000 1.12
+++ AOPInstance.java 25 Oct 2006 14:12:59 -0000 1.12.2.1
@@ -54,6 +54,15 @@
set(instance);
}
+ public AOPInstance copy()
+ {
+ AOPInstance objCopy = new AOPInstance(instance_);
+ objCopy.refCount_ = refCount_;
+ objCopy.refFqn_ = refFqn_;
+ objCopy.referencingFqnList_ = (referencingFqnList_ == null ? null : new ArrayList(referencingFqnList_));
+ return objCopy;
+ }
+
Object get()
{
return instance_;
1.38.2.2 +18 -12 JBossCache/src/org/jboss/cache/aop/InternalDelegate.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InternalDelegate.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/aop/InternalDelegate.java,v
retrieving revision 1.38.2.1
retrieving revision 1.38.2.2
diff -u -b -r1.38.2.1 -r1.38.2.2
--- InternalDelegate.java 25 Jun 2006 01:16:22 -0000 1.38.2.1
+++ InternalDelegate.java 25 Oct 2006 14:12:59 -0000 1.38.2.2
@@ -91,9 +91,10 @@
*/
int incrementRefCount(Fqn originalFqn, Fqn referencingFqn) throws CacheException
{
- AOPInstance aopInstance = getAopInstance(originalFqn);
- if(aopInstance == null)
+ AOPInstance aopInstanceOrig = getAopInstance(originalFqn);
+ if(aopInstanceOrig == null)
throw new RuntimeException("InternalDelegate.incrementRefCount(): null aopInstance for fqn: " +originalFqn);
+ AOPInstance aopInstance = aopInstanceOrig.copy();
int count = aopInstance.incrementRefCount(referencingFqn);
// need to update it.
@@ -154,9 +155,10 @@
*/
int decrementRefCount(Fqn originalFqn, Fqn referencingFqn) throws CacheException
{
- AOPInstance aopInstance = getAopInstance(originalFqn);
- if(aopInstance == null)
+ AOPInstance aopInstanceOrig = getAopInstance(originalFqn);
+ if(aopInstanceOrig == null)
throw new RuntimeException("InternalDelegate.decrementRefCount(): null aopInstance.");
+ AOPInstance aopInstance = aopInstanceOrig.copy();
int count = aopInstance.decrementRefCount(referencingFqn);
@@ -198,9 +200,12 @@
void setRefFqn(Fqn fqn, String internalFqn) throws CacheException
{
- AOPInstance aopInstance = getAopInstance(fqn);
- if(aopInstance == null)
+ AOPInstance aopInstanceOrig = getAopInstance(fqn);
+ AOPInstance aopInstance = null;
+ if(aopInstanceOrig == null)
aopInstance = new AOPInstance();
+ else
+ aopInstance = aopInstanceOrig.copy();
aopInstance.setRefFqn(internalFqn);
put(fqn, AOPInstance.KEY, aopInstance);
@@ -208,9 +213,10 @@
void removeRefFqn(Fqn fqn) throws CacheException
{
- AOPInstance aopInstance = getAopInstance(fqn);
- if(aopInstance == null)
+ AOPInstance aopInstanceOrig = getAopInstance(fqn);
+ if(aopInstanceOrig == null)
throw new RuntimeException("InternalDelegate.getRefFqn(): null aopInstance.");
+ AOPInstance aopInstance = aopInstanceOrig.copy();
aopInstance.removeRefFqn();
put(fqn, AOPInstance.KEY, aopInstance);
1.74.2.6 +7 -7 JBossCache/src/org/jboss/cache/aop/TreeCacheAopDelegate.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TreeCacheAopDelegate.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/aop/TreeCacheAopDelegate.java,v
retrieving revision 1.74.2.5
retrieving revision 1.74.2.6
diff -u -b -r1.74.2.5 -r1.74.2.6
--- TreeCacheAopDelegate.java 16 Aug 2006 07:11:51 -0000 1.74.2.5
+++ TreeCacheAopDelegate.java 25 Oct 2006 14:12:59 -0000 1.74.2.6
@@ -174,12 +174,12 @@
Object oldValue = internal_.getPojo(fqn);
if(oldValue == obj) return obj; // value already in cache. return right away.
- if(oldValue != null)
- {
+ //if(oldValue != null)
+ //{
// Trigger bulk remove here for performance
setBulkRemove(true);
- cache_._removeObject(fqn, true); // remove old value before overwriting it.
- }
+ oldValue = cache_._removeObject(fqn, true); // remove old value before overwriting it.
+ //}
// Remember not to print obj here since it will trigger the CacheInterceptor.
if(log.isDebugEnabled()) {
@@ -229,8 +229,8 @@
protected boolean bulkRemove(Fqn fqn, Object obj) throws CacheException {
// Check for cross-reference. If there is, we can't do bulk remove
// map contains (pojo, cacheinterceptor) pair that needs to undo the the removal.
-// return false;
- Map undoMap = new HashMap();
+ return false;
+ /*Map undoMap = new HashMap();
if(pojoGraphMultipleReferenced(obj, undoMap))
{
undoInterceptorDetach(undoMap);
@@ -239,7 +239,7 @@
{
cache_.remove(fqn); // interceptor has been removed so it is safe to do bulk remove now.
}
- return true;
+ return true;*/
}
protected void detachInterceptor(InstanceAdvisor advisor, Interceptor interceptor,
More information about the jboss-cvs-commits
mailing list