[jbosscache-commits] JBoss Cache SVN: r6048 - in pojo/trunk: src/main/java/org/jboss/cache/pojo/annotation and 8 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Jun 25 22:21:27 EDT 2008


Author: jason.greene at jboss.com
Date: 2008-06-25 22:21:26 -0400 (Wed, 25 Jun 2008)
New Revision: 6048

Removed:
   pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Attach.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/CheckIdValidity.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Detach.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Find.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Reentrant.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Tx.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/TxUndo.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/CheckIdInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/CheckNonSerializableInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/MethodReentrancyStopperInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoBeginInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoEventInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoFailedTxMockupInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxLockInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxUndoInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxUndoSynchronizationInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/StaticFieldInterceptor.java
Modified:
   pojo/trunk/pom.xml
   pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedListAbstract.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedListImpl.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedMapImpl.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedObjectArray.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedSetImpl.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CollectionInterceptorUtil.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/CacheListenerAdaptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalConstant.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalHelper.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ObjectGraphHandler.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheImpl.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoUtil.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxSynchronizationHandler.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/dynamic/AbstractCollectionInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/dynamic/CacheFieldInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/dynamic/CachedMapInterceptor.java
   pojo/trunk/src/main/java/org/jboss/cache/pojo/util/CacheApiUtil.java
   pojo/trunk/src/main/resources/META-INF/pojocache-aop.xml
   pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListImplTest.java
   pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListUndoTest.java
   pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalUndoTest.java
   pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapUndoTest.java
   pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ReplicatedTxTest.java
   pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetUndoTest.java
Log:
PCACHE-68 Remove self-weaved interceptor stack


Modified: pojo/trunk/pom.xml
===================================================================
--- pojo/trunk/pom.xml	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/pom.xml	2008-06-26 02:21:26 UTC (rev 6048)
@@ -122,44 +122,6 @@
           <redirectTestOutputToFile>false</redirectTestOutputToFile>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.jboss.maven.plugins</groupId>
-        <artifactId>maven-jbossaop-plugin</artifactId>
-        <version>1.0.0-SNAPSHOT</version>
-        <!-- HACK: AOP project and plugin has broken deps -->
-        <dependencies>    
-          <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-            <version>1.0.4</version>
-          </dependency>
-          <dependency>
-            <groupId>org.jboss.cache</groupId>
-            <artifactId>jbosscache-core</artifactId>
-            <version>${jbosscache-core-version}</version>
-          </dependency>
-          <dependency>
-            <groupId>org.jboss.aop</groupId>
-            <artifactId>jboss-aop</artifactId>
-            <version>${jboss.aop.version}</version>
-          </dependency>
-        </dependencies> 
-        <executions>
-          <execution>
-            <id>aopc</id>
-            <phase>compile</phase>
-            <goals>
-              <goal>compile</goal>
-            </goals>
-            <configuration>
-              <verbose>false</verbose>
-              <aoppaths>
-              <aoppath>${basedir}/src/main/resources/META-INF/pojocache-aop.xml</aoppath>
-              </aoppaths>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
       <!-- the docbook generation plugin for the user guide -->
       <plugin>
         <groupId>org.jboss.maven.plugins</groupId>

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Attach.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Attach.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Attach.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,25 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for PojoCache interceptor stack. This one checks for tx.
- *
- * @author Ben Wang
- * @version $Id$
- */
- at Retention(RetentionPolicy.RUNTIME)
- at Target(ElementType.METHOD)
-public @interface Attach
-{
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/CheckIdValidity.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/CheckIdValidity.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/CheckIdValidity.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,25 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for PojoCache interceptor stack. This one to check id validity.
- *
- * @author Ben Wang
- * @version $Id$
- */
- at Retention(RetentionPolicy.RUNTIME)
- at Target(ElementType.METHOD)
-public @interface CheckIdValidity
-{
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Detach.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Detach.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Detach.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,25 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for PojoCache interceptor stack. This one checks for tx.
- *
- * @author Ben Wang
- * @version $Id$
- */
- at Retention(RetentionPolicy.RUNTIME)
- at Target(ElementType.METHOD)
-public @interface Detach
-{
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Find.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Find.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Find.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,25 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for PojoCache interceptor stack. This one checks for tx.
- *
- * @author Ben Wang
- * @version $Id$
- */
- at Retention(RetentionPolicy.RUNTIME)
- at Target(ElementType.METHOD)
-public @interface Find
-{
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Reentrant.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Reentrant.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Reentrant.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annoataion that wraps the Prepare annotation of JBossAop.
- *
- * @author Ben Wang
- *         Date: Jan 22, 2006
- * @version $Id$
- */
- at Retention(RetentionPolicy.RUNTIME)
- at Target(ElementType.TYPE)
-public @interface Reentrant
-{
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Tx.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Tx.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/Tx.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,25 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for PojoCache interceptor stack. This one checks for tx.
- *
- * @author Ben Wang
- * @version $Id$
- */
- at Retention(RetentionPolicy.RUNTIME)
- at Target(ElementType.METHOD)
-public @interface Tx
-{
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/TxUndo.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/TxUndo.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/annotation/TxUndo.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,25 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for PojoCache interceptor stack. This one annotates method to provide rollback operation.
- *
- * @author Ben Wang
- * @version $Id$
- */
- at Retention(RetentionPolicy.RUNTIME)
- at Target(ElementType.METHOD)
-public @interface TxUndo
-{
-}

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedListAbstract.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedListAbstract.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedListAbstract.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -6,8 +6,6 @@
  */
 package org.jboss.cache.pojo.collection;
 
-import org.jboss.cache.pojo.annotation.Reentrant;
-
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
@@ -17,8 +15,6 @@
  *
  * @author Scott Marlow
  */
-
- at Reentrant
 abstract class CachedListAbstract implements List
 {
    public void clear()

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedListImpl.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedListImpl.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedListImpl.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -76,7 +76,7 @@
    public Object get(int index)
    {
       checkIndex();
-      return Null.toNullValue(pojoCache.getObject(AopUtil.constructFqn(getFqn(), IntegerCache.toString(index))));
+      return Null.toNullValue(pojoCache.find(AopUtil.constructFqn(getFqn(), IntegerCache.toString(index))));
    }
 
    private static void checkIndex()
@@ -229,7 +229,7 @@
                throw new NoSuchElementException("CachedSetImpl.iterator.next(). " +
                        " Cursor position " + current + " is greater than the size " + size());
 
-            return Null.toNullValue(pojoCache.getObject(AopUtil.constructFqn(getFqn(), IntegerCache.toString(++current))));
+            return Null.toNullValue(pojoCache.find(AopUtil.constructFqn(getFqn(), IntegerCache.toString(++current))));
          }
 
          public void remove()
@@ -282,6 +282,22 @@
       return new MyListIterator(this, index);
    }
 
+   public String toString()
+   {
+      StringBuffer buf = new StringBuffer();
+      int size = size();
+      for (int i = 0; i < size; i++)
+      {
+         Object key = get(i);
+         if (key == interceptor.getBoundProxy())
+            key = "(this list)";
+         buf.append("[").append(key).append("]");
+         if (i <= size) buf.append(", ");
+      }
+
+      return buf.toString();
+   }
+
    static class MyListIterator implements ListIterator
    {
       int index = 0;

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedMapImpl.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedMapImpl.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedMapImpl.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -20,11 +20,9 @@
 
 import org.jboss.aop.Advised;
 import org.jboss.cache.Cache;
-import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
 import org.jboss.cache.pojo.PojoCacheException;
-import org.jboss.cache.pojo.annotation.Reentrant;
 import org.jboss.cache.pojo.impl.PojoCacheImpl;
 import org.jboss.cache.pojo.interceptors.dynamic.AbstractCollectionInterceptor;
 import org.jboss.cache.pojo.util.CacheApiUtil;
@@ -36,7 +34,6 @@
  * @author Ben Wang
  * @author Scott Marlow
  */
- at Reentrant
 public class CachedMapImpl implements Map
 {
    private PojoCacheImpl pojoCache;
@@ -91,7 +88,7 @@
 
    public Object get(Object key)
    {
-      return Null.toNullValue(pojoCache.getObject(constructFqn(getFqn(), Null.toNullKeyObject(key))));
+      return Null.toNullValue(pojoCache.find(constructFqn(getFqn(), Null.toNullKeyObject(key))));
    }
 
    public Object put(Object key, Object value)
@@ -233,7 +230,7 @@
                {
                   Fqn f = ((Node) i.next()).getFqn();
                   lastKey = f.getLastElement();
-                  return Null.toNullValue(pojoCache.getObject(f));
+                  return Null.toNullValue(pojoCache.find(f));
                }
 
                public void remove()
@@ -344,7 +341,13 @@
       for (Iterator it = set.iterator(); it.hasNext();)
       {
          Object key = it.next();
-         buf.append("[").append(key).append(", ").append(get(key)).append("]");
+         Object value = get(key);
+         if (key == interceptor.getBoundProxy())
+            key = "(this map)";
+         if (value == interceptor.getBoundProxy())
+            value = "(this map)";
+
+         buf.append("[").append(key).append(", ").append(value).append("]");
          if (it.hasNext()) buf.append(", ");
       }
 
@@ -368,7 +371,7 @@
 
       public Object getValue()
       {
-         return Null.toNullValue(pojoCache.getObject(constructFqn(getFqn(), key)));
+         return Null.toNullValue(pojoCache.find(constructFqn(getFqn(), key)));
       }
 
       public Object setValue(Object value)

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedObjectArray.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedObjectArray.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedObjectArray.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -57,7 +57,7 @@
    {
       Fqn<?> fqn = AopUtil.constructFqn(this.fqn, IntegerCache.toString(index));
 
-      return Null.toNullValue(cache.getObject(fqn, null, arraySource));
+      return Null.toNullValue(cache.find(fqn, null, arraySource));
    }
 
    public void destroy()

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedSetImpl.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedSetImpl.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CachedSetImpl.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -17,11 +17,9 @@
 
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.pojo.annotation.Reentrant;
 import org.jboss.cache.pojo.impl.PojoCacheImpl;
 import org.jboss.cache.pojo.interceptors.dynamic.AbstractCollectionInterceptor;
 import org.jboss.cache.pojo.util.AopUtil;
@@ -39,7 +37,6 @@
  * @author Scott Marlow
  * @author Jussi Pyorre
  */
- at Reentrant
 public class CachedSetImpl extends AbstractSet
 {
    private PojoCacheImpl pojoCache;
@@ -172,6 +169,8 @@
       for (Iterator it = iterator(); it.hasNext();)
       {
          Object key = it.next();
+         if (key == interceptor.getBoundProxy())
+            key = "(this set)";
          buf.append("[").append(key).append("]");
          if (it.hasNext()) buf.append(", ");
       }
@@ -222,7 +221,7 @@
 
    private Object getNoUnmask(Object key)
    {
-      return pojoCache.getObject(AopUtil.constructFqn(getFqn(), key));
+      return pojoCache.find(AopUtil.constructFqn(getFqn(), key));
    }
 
    public int hashCode()
@@ -275,7 +274,7 @@
       public Object next()
       {
          node = iterator.next();
-         o = Null.toNullValue(pojoCache.getObject(node.getFqn()));
+         o = Null.toNullValue(pojoCache.find(node.getFqn()));
          return o;
       }
 

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CollectionInterceptorUtil.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CollectionInterceptorUtil.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/collection/CollectionInterceptorUtil.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -50,6 +50,7 @@
       ClassProxy result = ClassProxyFactory.newInstance(clazz, null, true);
       InstanceAdvisor advisor = result._getInstanceAdvisor();
       advisor.appendInterceptor(interceptor);
+      interceptor.setBoundProxy(result);
 
       return result;
    }

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -102,7 +102,7 @@
             if (CachedType.isSimpleAttribute(field))
                result = cache_.get(fqn, field.getName());
             else
-               result = pCache_.getObject(fqn, field.getName(), obj);
+               result = pCache_.find(fqn, field.getName(), obj);
 
             field.set(obj, result);
          }
@@ -192,7 +192,7 @@
          // But we will have to ignore it if value is null
          if (value instanceof Map || value instanceof List || value instanceof Set)
          {
-            Object newValue = pCache_.getObject(fqn, field.getName(), obj);
+            Object newValue = pCache_.find(fqn, field.getName(), obj);
             util_.inMemorySubstitution(obj, field, newValue);
          }
       }

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/CacheListenerAdaptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/CacheListenerAdaptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/CacheListenerAdaptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -26,6 +26,7 @@
 import static org.jboss.cache.notifications.event.Event.Type.TRANSACTION_REGISTERED;
 import static org.jboss.cache.pojo.impl.InternalConstant.POJOCACHE_OPERATION;
 import static org.jboss.cache.pojo.impl.InternalConstant.POJOCACHE_STATUS;
+import static org.jboss.cache.pojo.impl.InternalConstant.POJOCACHE_LOCK;
 
 import java.lang.reflect.Field;
 import java.util.Collection;
@@ -48,7 +49,6 @@
 import org.jboss.cache.notifications.event.TransactionalEvent;
 import org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType;
 import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.interceptors.PojoTxLockInterceptor;
 import org.jboss.cache.pojo.notification.NotificationContext;
 import org.jboss.cache.pojo.notification.event.ArrayModifiedEvent;
 import org.jboss.cache.pojo.notification.event.AttachedEvent;
@@ -80,7 +80,7 @@
       internalKeys.add(POJOCACHE_OPERATION);
       internalKeys.add(PojoInstance.KEY);
       internalKeys.add(PojoReference.KEY);
-      internalKeys.add(PojoTxLockInterceptor.LOCK_KEY);
+      internalKeys.add(POJOCACHE_LOCK);
    }
 
    private PojoCacheImpl cache;

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalConstant.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalConstant.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalConstant.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -28,4 +28,5 @@
    public static final String POJOCACHE_KEY_PREFIX = "POJOCache.";
    public static final String POJOCACHE_STATUS = POJOCACHE_KEY_PREFIX + "Status";
    public static final String POJOCACHE_OPERATION = POJOCACHE_KEY_PREFIX + "Operation";
+   public static final String POJOCACHE_LOCK = POJOCACHE_KEY_PREFIX + "LOCK";
 }

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalHelper.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalHelper.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalHelper.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -13,6 +13,7 @@
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheException;
 import org.jboss.cache.Fqn;
+import org.jboss.cache.lock.UpgradeException;
 import org.jboss.cache.pojo.PojoCache;
 import org.jboss.cache.pojo.PojoCacheException;
 import org.jboss.cache.pojo.util.ObjectUtil;
@@ -374,4 +375,42 @@
 
       return false;
    }
-}
+
+   public boolean lockPojo(Fqn id) throws CacheException
+   {
+      final int RETRY = 5;
+
+      if (log.isDebugEnabled())
+         log.debug("lockPojo(): id:" + id);
+
+      boolean isNeeded = true;
+      int retry = 0;
+
+      while (isNeeded)
+      {
+         try
+         {
+            cache.put(id, InternalConstant.POJOCACHE_LOCK, "LOCK");
+            isNeeded = false;
+         }
+         catch (UpgradeException upe)
+         {
+            log.warn("lockPojo(): can't upgrade the lock during lockPojo. Will re-try. id: " + id
+                     + " retry times: " + retry);
+            if (retry++ > RETRY)
+               return false;
+
+            // try to sleep a little as well.
+            try
+            {
+               Thread.sleep(10);
+            }
+            catch (InterruptedException e)
+            {
+            }
+         }
+      }
+
+      return true;
+   }
+}
\ No newline at end of file

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ObjectGraphHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ObjectGraphHandler.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ObjectGraphHandler.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -48,7 +48,7 @@
       // Note this is actually the aliasFqn, not the real fqn!
       Object obj;
 
-      obj = cache.getObject(fqn);
+      obj = cache.find(fqn);
       if (obj == null)
          throw new PojoCacheException("ObjectGraphHandler.get(): null object from internal ref node." +
                                       " Internal ref node: " + fqn);

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -51,8 +51,6 @@
    private ArrayHandler arrayHandler;
    private SerializableObjectHandler serializableHandler_;
    // Use ThreadLocal to hold a boolean isBulkRemove
-   private ThreadLocal<Boolean> bulkRemove_ = new ThreadLocal<Boolean>();
-   private final String DETACH = "DETACH";
    private PojoUtil util_ = new PojoUtil();
 
    public PojoCacheDelegate(PojoCacheImpl cache)
@@ -67,16 +65,6 @@
       arrayHandler = new ArrayHandler(pojoCache);
    }
 
-   public void setBulkRemove(boolean bulk)
-   {
-      bulkRemove_.set(bulk);
-   }
-
-   private boolean getBulkRemove()
-   {
-      return bulkRemove_.get();
-   }
-
    public Object getObject(Fqn fqn, String field, Object source) throws CacheException
    {
       // TODO Must we really to couple with BR? JBCACHE-669
@@ -114,6 +102,8 @@
     */
    public Object putObject(Fqn fqn, Object obj, String field, Object source) throws CacheException
    {
+      internal_.lockPojo(fqn);
+
       // Skip some un-necessary update if obj is the same class as the old one
       Object oldValue = internal_.getPojo(fqn, field);
       boolean allowArray = source instanceof ArrayInterceptable;
@@ -229,6 +219,8 @@
     */
    public Object removeObject(Fqn fqn, String field, Object source) throws CacheException
    {
+      internal_.lockPojo(fqn);
+
       // the class attribute is implicitly stored as an immutable read-only attribute
       PojoReference pojoReference = internal_.getPojoReference(fqn, field);
       if (pojoReference == null)
@@ -249,7 +241,7 @@
                    + " with the corresponding internal id: " + internalFqn);
       }
 
-      Object result = pojoCache.getObject(internalFqn);
+      Object result = pojoCache.find(internalFqn);
       if (result == null)
          return null;
 

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheImpl.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheImpl.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheImpl.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -12,6 +12,10 @@
 import java.util.WeakHashMap;
 import java.util.regex.Pattern;
 
+import javax.transaction.Status;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Cache;
@@ -25,9 +29,8 @@
 import org.jboss.cache.pojo.PojoCache;
 import org.jboss.cache.pojo.PojoCacheException;
 import org.jboss.cache.pojo.PojoCacheThreadContext;
-import org.jboss.cache.pojo.annotation.Attach;
-import org.jboss.cache.pojo.annotation.Detach;
-import org.jboss.cache.pojo.annotation.Find;
+import org.jboss.cache.pojo.interceptors.PojoTxSynchronizationHandler;
+import org.jboss.cache.transaction.BatchModeTransactionManager;
 
 /**
  * Implementation class for PojoCache interface
@@ -94,75 +97,134 @@
       return attach(Fqn.fromString(id), pojo);
    }
 
-   @Attach
    public Object attach(Fqn<?> id, Object pojo) throws PojoCacheException
    {
+      return attach(id, pojo, null, null);
+   }
+
+   public Object attach(Fqn<?> id, Object pojo, String field, Object source) throws PojoCacheException
+   {
+      TransactionManager tm = getTransactionManager();
+      boolean createdTransaction = setupTransaction(tm);
       try
       {
-         Object obj = putObject(id, pojo, null, null);
+         Object obj = delegate_.putObject(id, pojo, field, source);
          return obj;
       }
-      catch (CacheException e)
+      catch (Throwable t)
       {
-         throw new PojoCacheException("putObject failed " + id, e);
+         setRollbackOnly(tm);
+         throw new PojoCacheException("attach failed " + id, t);
       }
+      finally
+      {
+         if (createdTransaction)
+            endTransaction(tm, id);
+      }
    }
 
-   @Attach
-   public Object attach(Fqn<?> id, Object pojo, String field, Object source) throws PojoCacheException
+   public Object detach(Fqn<?> id, String field, Object source) throws PojoCacheException
    {
+      TransactionManager tm = getTransactionManager();
+      boolean createdTransaction = setupTransaction(tm);
       try
       {
-         Object obj = putObject(id, pojo, field, source);
+         Object obj = delegate_.removeObject(id, field, source);
          return obj;
       }
-      catch (CacheException e)
+      catch (Throwable t)
       {
-         throw new PojoCacheException("putObject failed " + id, e);
+         setRollbackOnly(tm);
+         throw new PojoCacheException("detach failed " + id, t);
       }
+      finally
+      {
+         if (createdTransaction)
+            endTransaction(tm, id);
+      }
    }
 
-   /**
-    * This public API is called from internal package only.
-    */
-   public Object putObject(Fqn<?> id, Object pojo, String field, Object source) throws CacheException
+   private void endTransaction(TransactionManager tm, Fqn<?> id)
    {
-      return delegate_.putObject(id, pojo, field, source);
+      try
+      {
+         switch (tm.getStatus())
+         {
+            case Status.STATUS_PREPARING:
+            case Status.STATUS_PREPARED:
+            case Status.STATUS_ACTIVE:
+               tm.commit();
+               break;
+            case Status.STATUS_MARKED_ROLLBACK:
+               tm.rollback();
+               break;
+         }
+      }
+      catch (Throwable t)
+      {
+         if (log_.isWarnEnabled())
+            log_.warn("Could not end transaction for operation on: " + id, t);
+      }
    }
 
-   public Object detach(String id) throws PojoCacheException
+   private void setRollbackOnly(TransactionManager tm)
    {
-      return detach(Fqn.fromString(id));
+      try
+      {
+         if (tm.getStatus() != Status.STATUS_MARKED_ROLLBACK)
+            tm.setRollbackOnly();
+      }
+      catch (Throwable t)
+      {
+         if (log_.isWarnEnabled())
+            log_.warn("Could not rollback transaction!", t);
+      }
    }
 
-   @Detach
-   public Object detach(Fqn<?> id, String field, Object source) throws PojoCacheException
+   private boolean setupTransaction(TransactionManager tm)
    {
+      boolean created = false;
       try
       {
-         Object pojo = getObject(id, field, source);// TODO need optimization here since it will be redundant here
-         if (pojo == null) return pojo;
+         Transaction transaction = tm.getTransaction();
+         if (transaction == null)
+         {
+            tm.begin();
+            transaction = tm.getTransaction();
+            created = true;
+         }
 
-         Object obj = removeObject(id, field, source);
-         return obj;
+         transaction.registerSynchronization(PojoTxSynchronizationHandler.create());
       }
-      catch (CacheException e)
+      catch (Exception e)
       {
-         throw new PojoCacheException("detach " + id + " failed", e);
+         throw new PojoCacheException("Error creating transaction", e);
       }
+
+      return created;
    }
 
-   public Object detach(Fqn<?> id) throws PojoCacheException
+   private TransactionManager getTransactionManager()
    {
-      return detach(id, null, null);
+      TransactionManager tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
+      if (tm == null)
+         tm = BatchModeTransactionManager.getInstance();
+
+      return tm;
    }
 
-   public Object removeObject(Fqn<?> id, String field, Object source) throws CacheException
+   public Object detach(String id) throws PojoCacheException
    {
-      delegate_.setBulkRemove(false);
-      return delegate_.removeObject(id, field, source);
+      return detach(Fqn.fromString(id));
    }
 
+
+
+   public Object detach(Fqn<?> id) throws PojoCacheException
+   {
+      return detach(id, null, null);
+   }
+
    public String getPojoID(Object pojo)
    {
       throw new PojoCacheException("getPojoID not yet implemented");
@@ -178,12 +240,11 @@
       return find(Fqn.fromString(id));
    }
 
-   @Find
    public Object find(Fqn<?> id) throws PojoCacheException
    {
       try
       {
-         return getObject(id);
+         return find(id, null, null);
       }
       catch (CacheException e)
       {
@@ -191,13 +252,8 @@
       }
    }
 
-   public Object getObject(Fqn<?> id) throws CacheException
+   public Object find(Fqn<?> id, String field, Object source) throws CacheException
    {
-      return getObject(id, null, null);
-   }
-
-   public Object getObject(Fqn<?> id, String field, Object source) throws CacheException
-   {
       return delegate_.getObject(id, field, source);
    }
 
@@ -207,7 +263,6 @@
       return findAll(Fqn.fromString(id));
    }
 
-   @Find
    public Map<Fqn<?>, Object> findAll(Fqn<?> id) throws PojoCacheException
    {
       // Should produce "/"

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoUtil.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoUtil.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoUtil.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -8,19 +8,19 @@
 package org.jboss.cache.pojo.impl;
 
 import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.util.List;
 
-import org.jboss.aop.Advised;
-import org.jboss.aop.Domain;
 import org.jboss.aop.InstanceAdvisor;
 import org.jboss.aop.advice.Interceptor;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.pojo.PojoCacheException;
-import org.jboss.cache.pojo.annotation.TxUndo;
 import org.jboss.cache.pojo.collection.CachedArray;
 import org.jboss.cache.pojo.collection.CachedArrayRegistry;
+import org.jboss.cache.pojo.interceptors.PojoTxSynchronizationHandler;
 import org.jboss.cache.pojo.interceptors.dynamic.AbstractCollectionInterceptor;
 import org.jboss.cache.pojo.interceptors.dynamic.CacheFieldInterceptor;
+import org.jboss.cache.pojo.util.MethodCall;
 
 /**
  * Utility class for method wrappers that we are interested to rollback (i.e., rollback).
@@ -30,33 +30,48 @@
  */
 public class PojoUtil
 {
-   private static final String BindingName = "ReentrancyStopperInterceptor.";
-
-   @TxUndo
    public void attachInterceptor(Object pojo, InstanceAdvisor advisor, Interceptor interceptor)
    {
       _attachInterceptor(pojo, advisor, interceptor);
+      Method method = MethodDeclarations.undoAttachInterceptor;
+      MethodCall mc = new MethodCall(method, new Object[] {pojo, advisor, interceptor}, this);
+      addUndo(mc);
    }
 
-   @TxUndo
    public void detachInterceptor(InstanceAdvisor advisor, Interceptor interceptor)
    {
       _detachInterceptor(advisor, interceptor);
+      Method method = MethodDeclarations.undoDetachInterceptor;
+      MethodCall mc = new MethodCall(method, new Object[] {advisor, interceptor}, this);
+      addUndo(mc);
    }
 
-   @TxUndo
+   private void addUndo(MethodCall mc)
+   {
+      PojoTxSynchronizationHandler handler = PojoTxSynchronizationHandler.current();
+      if (handler != null)
+         handler.addToList(mc);
+   }
+
    public void detachCollectionInterceptor(AbstractCollectionInterceptor interceptor) {
       interceptor.detach(true);
+      Method method = MethodDeclarations.undoDetachCollectionInterceptor;
+      MethodCall mc = new MethodCall(method, new Object[] {interceptor}, this);
+      addUndo(mc);
    }
 
-   @TxUndo
    public void attachArray(Object array, CachedArray cached) {
       CachedArrayRegistry.register(array, cached);
+      Method method = MethodDeclarations.undoAttachArray;
+      MethodCall mc = new MethodCall(method, new Object[] {array, cached}, this);
+      addUndo(mc);
    }
 
-   @TxUndo
    public void detachArray(Object array, CachedArray cached) {
       CachedArrayRegistry.unregister(array);
+      Method method = MethodDeclarations.undoDetachArray;
+      MethodCall mc = new MethodCall(method, new Object[] {array, cached}, this);
+      addUndo(mc);
    }
 
    public void undoAttachInterceptor(Object pojo, InstanceAdvisor advisor, Interceptor interceptor)
@@ -87,11 +102,23 @@
       CachedArrayRegistry.register(array, cached);
    }
 
-
-   @TxUndo
    public void inMemorySubstitution(Object obj, Field field, Object newValue)
    {
+      Method method = MethodDeclarations.undoInMemorySubstitution;
+      Object[] args;
+      try
+      {
+         args = new Object[]{obj, field, field.get(obj)};
+      }
+      catch (Throwable t)
+      {
+         throw new PojoCacheException("Severe error building undo list", t);
+      }
+
       _inMemorySubstitution(obj, field, newValue);
+
+      MethodCall mc = new MethodCall(method, args, this);
+      addUndo(mc);
    }
 
    public void undoInMemorySubstitution(Object obj, Field field, Object oldValue)
@@ -104,13 +131,6 @@
       advisor.appendInterceptor(interceptor);
    }
 
-   private Domain getInstanceDomain(Object obj)
-   {
-      Advised advised = ((Advised) obj);
-      InstanceAdvisor advisor = advised._getInstanceAdvisor();
-      return advisor.getDomain();
-   }
-
    private void _inMemorySubstitution(Object obj, Field field, Object newValue)
    {
       try
@@ -137,10 +157,14 @@
       }
    }
 
-   @TxUndo
-   public int incrementReferenceCount(Fqn sourceFqn, int count, List refList)
+   public int incrementReferenceCount(Fqn<?> sourceFqn, int count, List<?> refList)
    {
-      return _incrementReferenceCount(sourceFqn, count, refList);
+      int ret = _incrementReferenceCount(sourceFqn, count, refList);
+      Method method = MethodDeclarations.undoIncrementReferenceCount;
+      Object[] args = new Object[]{sourceFqn, count, refList};
+      MethodCall mc = new MethodCall(method, args, this);
+      addUndo(mc);
+      return ret;
    }
 
    public int undoIncrementReferenceCount(Fqn sourceFqn, int count, List refList)
@@ -154,10 +178,14 @@
       return count + 1;
    }
 
-   @TxUndo
-   public int decrementReferenceCount(Fqn sourceFqn, int count, List refList)
+   public int decrementReferenceCount(Fqn<?> sourceFqn, int count, List<?> refList)
    {
-      return _decrementReferenceCount(sourceFqn, count, refList);
+      int ret = _decrementReferenceCount(sourceFqn, count, refList);
+      Method method = MethodDeclarations.undoDecrementReferenceCount;
+      Object[] args = new Object[]{sourceFqn, count, refList};
+      MethodCall mc = new MethodCall(method, args, this);
+      addUndo(mc);
+      return ret;
    }
 
    public int undoDecrementReferenceCount(Fqn sourceFqn, int count, List refList)

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/CheckIdInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/CheckIdInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/CheckIdInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.interceptors;
-
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.cache.Fqn;
-
-/**
- * Interceptor (done via aop advice) to check the validity of the id specified by the user.
- *
- * @version $Id$
- */
-public class CheckIdInterceptor extends AbstractInterceptor
-{
-   public Object invoke(Invocation in) throws Throwable
-   {
-      if (!(in instanceof MethodInvocation))
-      {
-         throw new IllegalArgumentException("CheckIdInterceptor.invoke(): invocation not MethodInvocation");
-      }
-
-      MethodInvocation invocation = (MethodInvocation) in;
-      invocation.getAdvisor();
-      try
-      {
-         checkFqnValidity((Fqn) invocation.getArguments()[0]);
-         return invocation.invokeNext(); // proceed to next advice or actual call
-      }
-      finally
-      {
-      }
-   }
-
-
-   private static void checkFqnValidity(Fqn id)
-   {
-      // throws exception is fqn is JBossInternal
-//      if (id.hasElement(InternalConstant.JBOSS_INTERNAL_STRING))
-//      {
-//         throw new IllegalArgumentException("CheckIdIntercepto.checkFqnValidity(): fqn is not valid: " + id);
-//      }
-   }
-}
-

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/CheckNonSerializableInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/CheckNonSerializableInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/CheckNonSerializableInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.interceptors;
-
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.pojo.util.AopUtil;
-
-/**
- * Interceptor (done via aop advice) to check the validity of the id specified by the user.
- *
- * @version $Id$
- */
-public class CheckNonSerializableInterceptor extends AbstractInterceptor
-{
-   private boolean marshallNonSerializable_ = false;
-
-   public Object invoke(Invocation in) throws Throwable
-   {
-      if (!(in instanceof MethodInvocation))
-      {
-         throw new IllegalArgumentException("CheckIdInterceptor.invoke(): invocation not MethodInvocation");
-      }
-
-      MethodInvocation invocation = (MethodInvocation) in;
-      Fqn id = (Fqn) invocation.getArguments()[0];
-      Object obj = invocation.getArguments()[1];
-      if (!marshallNonSerializable_)
-      {
-         AopUtil.checkObjectType(obj);
-      }
-      else
-      {
-         log.debug("invoke(): marshallNonSerializable is set to true. We will skip object type checking for id:"
-                   + id.toString());
-      }
-
-      try
-      {
-         return invocation.invokeNext(); // proceed to next advice or actual call
-      }
-      finally
-      {
-      }
-   }
-
-   public void setMarshallNonSerializable(boolean isTrue)
-   {
-      marshallNonSerializable_ = isTrue;
-   }
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/MethodReentrancyStopperInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/MethodReentrancyStopperInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/MethodReentrancyStopperInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.interceptors;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.cache.pojo.PojoCacheException;
-
-import java.lang.reflect.Method;
-
-/**
- * @author Ben Wang
- */
-
-public class MethodReentrancyStopperInterceptor implements Interceptor
-{
-   private final Log log_ = LogFactory.getLog(MethodReentrancyStopperInterceptor.class);
-   private ThreadLocal<Boolean> done;
-   private String methodName;
-
-   public MethodReentrancyStopperInterceptor()
-   {
-      done = new ThreadLocal<Boolean>();
-      done.set(false);
-   }
-
-   public void setMethodName(String mname)
-   {
-      methodName = mname;
-   }
-
-   public String getName()
-   {
-      return MethodReentrancyStopperInterceptor.class.getName() + "-" + methodName;
-   }
-
-   public Object invoke(Invocation invocation) throws Throwable
-   {
-      boolean wasDone = done.get();
-
-      try
-      {
-         if (!wasDone)
-         {
-            done.set(true);
-            return invocation.invokeNext();
-         }
-         else
-         {
-            //Needs adding, and will invoke target joinpoint skipping the rest of the chain
-            if (log_.isDebugEnabled())
-            {
-               Method method = ((MethodInvocation) invocation).getMethod();
-               log_.debug("Detect recursive interception. Will call the target directly: " + method.getName());
-            }
-
-            if (methodName.equals("toString"))
-            {
-               return invocation.getTargetObject().getClass().getName();
-            }
-            else if (methodName.equals("hashCode"))
-            {
-               return 0;
-            }
-            else
-            {
-               throw new PojoCacheException("MethodReentrancyStopperInterceptor.invoke(): unknown method name"
-                                            + methodName);
-            }
-         }
-      }
-      finally
-      {
-         if (!wasDone)
-         {
-            done.set(false);
-         }
-      }
-   }
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoBeginInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoBeginInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoBeginInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.interceptors;
-
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.metadata.SimpleMetaData;
-
-/**
- * The first interceptor that deals initialization.
- *
- * @author Ben Wang
- * @version $Id$
- */
-public class PojoBeginInterceptor extends AbstractInterceptor
-{
-   public Object invoke(Invocation in) throws Throwable
-   {
-      if (!(in instanceof MethodInvocation))
-      {
-         throw new IllegalArgumentException("BeginInterceptor.invoke(): invocation not MethodInvocation");
-      }
-      MethodInvocation invocation = (MethodInvocation) in;
-      // Let's initialize the metadata
-      SimpleMetaData simple = new SimpleMetaData();
-      invocation.setMetaData(simple);
-
-      try
-      {
-         log.debug("**** Entering method: **** " + invocation.getMethod());
-         return invocation.invokeNext(); // proceed to next advice or actual call
-      }
-      finally
-      {
-//         reset(); // reset
-         log.debug("Leaving method: " + invocation.getMethod());
-      }
-   }
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoEventInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoEventInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoEventInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.interceptors;
-
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-
-/**
- * Handles the POJO event notification.
- *
- * @author Ben Wang
- * @version $Id$
- */
-public class PojoEventInterceptor extends AbstractInterceptor
-{
-   public Object invoke(Invocation in) throws Throwable
-   {
-      if (!(in instanceof MethodInvocation))
-      {
-         throw new IllegalArgumentException("PojoEventInterceptor.invoke(): invocation not MethodInvocation");
-      }
-      MethodInvocation invocation = (MethodInvocation) in;
-      try
-      {
-         System.out.println("**** Entering method: **** " + invocation.getMethod());
-         return invocation.invokeNext(); // proceed to next advice or actual call
-      }
-      finally
-      {
-         System.out.println("Leaving method: " + invocation.getMethod());
-      }
-   }
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoFailedTxMockupInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoFailedTxMockupInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoFailedTxMockupInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.interceptors;
-
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.pojo.impl.InternalConstant;
-
-import javax.transaction.Transaction;
-
-/**
- * Interceptor to mockup tx failure that resulting in rollback. User can simulate a rollback
- * by setting the static method <code>setRollback</code>. Note that you will need to use
- * setRollback for every method call, that is, it will reset itself after a rollback
- * has been performed.
- *
- * @author Ben Wang
- * @version $Id$
- */
-public class PojoFailedTxMockupInterceptor extends AbstractInterceptor
-{
-   public static boolean TX_ROLLBACK = false;
-
-   public static void setTxRollback(boolean isTrue)
-   {
-      TX_ROLLBACK = isTrue;
-   }
-
-   public Object invoke(Invocation in) throws Throwable
-   {
-      if (!(in instanceof MethodInvocation))
-      {
-         throw new IllegalArgumentException(
-                 "PojoFailedTxMockupInterceptor.invoke(): invocation not MethodInvocation");
-      }
-      MethodInvocation invocation = (MethodInvocation) in;
-      try
-      {
-         Object obj = null;
-         obj = invocation.invokeNext(); // proceed to next advice or actual call
-         if(TX_ROLLBACK)
-         {
-            Transaction tx = (Transaction)
-                    invocation.getMetaData().getMetaData(PojoTxInterceptor.TAG, PojoTxInterceptor.TX);
-
-            Fqn id = (Fqn) invocation.getArguments()[0];
-
-            if(!id.isChildOrEquals(InternalConstant.JBOSS_INTERNAL))
-            {
-               tx.setRollbackOnly();
-               TX_ROLLBACK = false;
-            }
-         }
-         return obj;
-      } finally
-      {
-      }
-   }
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,145 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.interceptors;
-
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.pojo.PojoCacheException;
-import org.jboss.cache.transaction.BatchModeTransactionManager;
-
-import javax.transaction.RollbackException;
-import javax.transaction.Status;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-/**
- * Interceptor (done via aop advice) for transaction
- *
- * @author Ben Wang
- * @version $Id$
- */
-public class PojoTxInterceptor extends AbstractInterceptor
-{
-   private TransactionManager localTm_ = null;
-   private TransactionManager txManager_;
-   public static final String TAG = "PC";
-   public static final String TX = "TX";
-
-
-   public Object invoke(Invocation in) throws Throwable
-   {
-      if (!(in instanceof MethodInvocation))
-      {
-         throw new IllegalArgumentException("TxInterceptor.invoke(): invocation not MethodInvocation");
-      }
-      MethodInvocation invocation = (MethodInvocation) in;
-
-      if (txManager_ == null)
-      {
-         txManager_ = getCache(invocation).getTransactionManager();
-      }
-
-      Transaction tx = null;
-      if (txManager_ != null)
-      {
-         // Use the configured one if so setup.
-         localTm_ = txManager_;
-      }
-      else
-      {
-         localTm_ = BatchModeTransactionManager.getInstance();
-      }
-
-      tx = localTm_.getTransaction();
-
-      boolean needTx = false;
-      if (tx == null) needTx = true;
-      Fqn id = null;
-      try
-      {
-         if (needTx)
-         {
-            id = (Fqn) invocation.getArguments()[0];
-            log.debug("Initiating a local transaction for batch processing with id: " + id.toString());
-            // Start one of our own as batch processing.
-            try
-            {
-               localTm_.begin();
-               tx = localTm_.getTransaction();
-               // Stuff tx context into the metadata
-               invocation.getMetaData().addMetaData(TAG, TX, tx);
-               return invocation.invokeNext(); // proceed to next advice or actual call
-            }
-            catch (Exception e)
-            {
-               log.warn(invocation.getMethod().getName() + ": exception occurred: " + e);
-               try
-               {
-                  localTm_.setRollbackOnly();
-               }
-               catch (Exception e2)
-               {
-                  log.error("setRollbackOnly", e2);
-               }
-
-               throw new PojoCacheException("PojoCache operation will be rollback. id: " + id
-                                            + ". Operation: " + invocation.getMethod().getName(), e);
-            }
-         }
-         else
-         {
-            invocation.getMetaData().addMetaData(TAG, TX, tx);
-            return invocation.invokeNext(); // proceed to next advice or actual call
-         }
-      }
-      finally
-      {
-         if (needTx)
-         {
-            endTransaction(id);
-         }
-      }
-   }
-
-   private void endTransaction(Fqn id)
-   {
-      if (localTm_ == null)
-      {
-         log.warn("endTransaction(): tm is null for id: " + id);
-         return;
-      }
-
-
-      try
-      {
-         if (localTm_.getTransaction().getStatus() != Status.STATUS_MARKED_ROLLBACK)
-         {
-            localTm_.commit();
-         }
-         else if (localTm_.getTransaction().getStatus() == Status.STATUS_ROLLEDBACK)
-         {
-            log.info("endTransaction(): has been rolled back for id: " + id);
-         }
-         else
-         {
-            log.info("endTransaction(): rolling back tx for id: " + id);
-            localTm_.rollback();
-         }
-      }
-      catch (RollbackException re)
-      {
-         // Do nothing here since cache may rollback automatically.
-         log.warn("endTransaction(): rolling back transaction with exception: " + re);
-      }
-      catch (Exception e)
-      {
-         log.warn("endTransaction(): Failed with exception: " + e);
-      }
-   }
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxLockInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxLockInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxLockInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,96 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.interceptors;
-
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.lock.UpgradeException;
-import org.jboss.cache.pojo.PojoCacheException;
-import org.jboss.cache.pojo.impl.InternalConstant;
-
-/**
- * Interceptor that handles the parent node lock associated with transaction.
- *
- * @author Ben Wang
- * @version $Id$
- */
-public class PojoTxLockInterceptor extends AbstractInterceptor
-{
-   public static final String LOCK_KEY = InternalConstant.POJOCACHE_KEY_PREFIX + "LOCK";
-   // retry times for lockPojo just in case there is upgrade exception during concurrent access.
-   private final int RETRY = 5;
-
-   public Object invoke(Invocation in) throws Throwable
-   {
-      MethodInvocation invocation = (MethodInvocation) in;
-      try
-      {
-         handleLock(invocation);
-         return invocation.invokeNext(); // proceed to next advice or actual call
-      }
-      finally
-      {
-//         handleUnLock(invocation);
-      }
-   }
-
-   private void handleLock(MethodInvocation invocation) throws Throwable
-   {
-      Fqn id = (Fqn) invocation.getArguments()[0];
-      Cache<Object, Object> cache = getCache(invocation);
-//      Object owner = cache.getLockOwner();
-      Object owner = null;
-      if (!lockPojo(owner, id, cache))
-      {
-         throw new PojoCacheException("PojoCache.removeObject(): Can't obtain the pojo lock under id: " + id);
-      }
-   }
-
-   private boolean lockPojo(Object owner, Fqn id, Cache<Object, Object> cache) throws CacheException
-   {
-      if (log.isDebugEnabled())
-      {
-         log.debug("lockPojo(): id:" + id + " Owner: " + owner);
-      }
-
-      boolean isNeeded = true;
-      int retry = 0;
-   
-      while (isNeeded)
-      {
-         try
-         {
-            cache.put(id, LOCK_KEY, "LOCK");
-            isNeeded = false;
-         }
-         catch (UpgradeException upe)
-         {
-            log.warn("lockPojo(): can't upgrade the lock during lockPojo. Will re-try. id: " + id
-                     + " retry times: " + retry);
-            if (retry++ > RETRY)
-            {
-               return false;
-            }
-            // try to sleep a little as well.
-            try
-            {
-               Thread.sleep(10);
-            }
-            catch (InterruptedException e)
-            {
-            }
-         }
-      }
-
-      return true;
-   }
-}

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxSynchronizationHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxSynchronizationHandler.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxSynchronizationHandler.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -24,15 +24,34 @@
  * @version $Id$
  */
 
-class PojoTxSynchronizationHandler implements Synchronization
+public class PojoTxSynchronizationHandler implements Synchronization
 {
    private static Log log = LogFactory.getLog(PojoTxSynchronizationHandler.class.getName());
    private List undoList_ = new ArrayList();
 
+   private static ThreadLocal<PojoTxSynchronizationHandler> handler = new ThreadLocal<PojoTxSynchronizationHandler>();
+
    PojoTxSynchronizationHandler()
    {
    }
 
+   public static PojoTxSynchronizationHandler current()
+   {
+      return handler.get();
+   }
+
+   public static PojoTxSynchronizationHandler create()
+   {
+      PojoTxSynchronizationHandler current = handler.get();
+      if (current == null)
+      {
+         current = new PojoTxSynchronizationHandler();
+         handler.set(current);
+      }
+
+      return current;
+   }
+
    public void beforeCompletion()
    {
       // Not interested
@@ -89,7 +108,8 @@
    public void resetUndoOp()
    {
       undoList_.clear();
-      PojoTxUndoSynchronizationInterceptor.reset();
+      handler.set(null);
+      //PojoTxUndoSynchronizationInterceptor.reset();
    }
 }
 

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxUndoInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxUndoInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxUndoInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.interceptors;
-
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.pojo.PojoCacheException;
-import org.jboss.cache.pojo.impl.MethodDeclarations;
-import org.jboss.cache.pojo.util.MethodCall;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.List;
-
-/**
- * Interceptor (done via aop advice) for transaction rollback. This is is attached to the
- * operation that needs a corresponding rollback, e.g., attachInterceptor.
- *
- * @author Ben Wang
- * @version $Id$
- */
-public class PojoTxUndoInterceptor extends AbstractInterceptor
-{
-   /// Just that AOP requires an extra key.
-   public static final String TAG = "PojoCache";
-
-   public Object invoke(Invocation in) throws Throwable
-   {
-      if (!(in instanceof MethodInvocation))
-      {
-         throw new IllegalArgumentException("TxUndoInterceptor.invoke(): invocation not MethodInvocation");
-      }
-      MethodInvocation invocation = (MethodInvocation) in;
-
-      PojoTxSynchronizationHandler handler =
-            PojoTxUndoSynchronizationInterceptor.getSynchronizationHandler();
-
-      if (handler == null)
-      {
-         return invocation.invokeNext();
-// TODO handler is null can mean we are not calling the right interceptor stack. Need to revisit.
-// E.g., a fresh getObject or find will trigger this.
-//         throw new IllegalStateException("PojoTxUndoInterceptor.invoke(): PojoTxSynchronizationHandler is null");
-      }
-
-      // Add to the rollback list
-      String methodName = invocation.getMethod().getName();
-      // TODO Needs to handle Collection interceptor as well.
-      if (methodName.equals(MethodDeclarations.attachInterceptor.getName()))
-      {
-         Method method = MethodDeclarations.undoAttachInterceptor;
-         MethodCall mc = new MethodCall(method, invocation.getArguments(), invocation.getTargetObject());
-         handler.addToList(mc);
-      }
-      else if (methodName.equals(MethodDeclarations.detachInterceptor.getName()))
-      {
-         Method method = MethodDeclarations.undoDetachInterceptor;
-         MethodCall mc = new MethodCall(method, invocation.getArguments(), invocation.getTargetObject());
-         handler.addToList(mc);
-      }
-      else if (methodName.equals(MethodDeclarations.detachCollectionInterceptor.getName()))
-      {
-         Method method = MethodDeclarations.undoDetachCollectionInterceptor;
-         MethodCall mc = new MethodCall(method, invocation.getArguments(), invocation.getTargetObject());
-         handler.addToList(mc);
-      }
-      else if (methodName.equals(MethodDeclarations.attachArray.getName()))
-      {
-         Method method = MethodDeclarations.undoAttachArray;
-         MethodCall mc = new MethodCall(method, invocation.getArguments(), invocation.getTargetObject());
-         handler.addToList(mc);
-      }
-      else if (methodName.equals(MethodDeclarations.detachArray.getName()))
-      {
-         Method method = MethodDeclarations.undoDetachArray;
-         MethodCall mc = new MethodCall(method, invocation.getArguments(), invocation.getTargetObject());
-         handler.addToList(mc);
-      }
-      else if (methodName.equals(MethodDeclarations.inMemorySubstitution.getName()))
-      {
-         Method method = MethodDeclarations.undoInMemorySubstitution;
-         Object obj = invocation.getArguments()[0];
-         Field field = (Field) invocation.getArguments()[1];
-         Object oldValue = field.get(obj);
-         Object[] args = new Object[]{obj, field, oldValue};
-         MethodCall mc = new MethodCall(method, args, invocation.getTargetObject());
-         handler.addToList(mc);
-      }
-      else if (methodName.equals(MethodDeclarations.incrementReferenceCount.getName()))
-      {
-         Method method = MethodDeclarations.undoIncrementReferenceCount;
-         Fqn fqn = (Fqn) invocation.getArguments()[0];
-         int count = (Integer) invocation.getArguments()[1];
-         List referenceList = (List) invocation.getArguments()[2];
-         Object[] args = new Object[]{fqn, count, referenceList};
-         MethodCall mc = new MethodCall(method, args, invocation.getTargetObject());
-         handler.addToList(mc);
-      }
-      else if (methodName.equals(MethodDeclarations.decrementReferenceCount.getName()))
-      {
-         Method method = MethodDeclarations.undoDecrementReferenceCount;
-         Fqn fqn = (Fqn) invocation.getArguments()[0];
-         int count = (Integer) invocation.getArguments()[1];
-         List referenceList = (List) invocation.getArguments()[2];
-         Object[] args = new Object[]{fqn, count, referenceList};
-         MethodCall mc = new MethodCall(method, args, invocation.getTargetObject());
-         handler.addToList(mc);
-      }
-      else
-      {
-         throw new PojoCacheException("PojoTxUndoInterceptor: invalid invocation name: " + methodName);
-      }
-
-      return invocation.invokeNext();
-   }
-
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxUndoSynchronizationInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxUndoSynchronizationInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/PojoTxUndoSynchronizationInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.cache.pojo.interceptors;
-
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.cache.pojo.PojoCacheException;
-
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-
-/**
- * Interceptor that handles registration of tx synchronization for rollback
- * operations.
- *
- * @author Ben Wang
- * @version $Id$
- */
-public class PojoTxUndoSynchronizationInterceptor extends AbstractInterceptor
-{
-   // We stores the handler in thread local since the afterCompletion won't be
-   // called untill tx.commit(). Note that this is static since it can be
-   // recursive call to attach/detach.
-   private static ThreadLocal synchronizationHandler_ = new ThreadLocal();
-
-   public Object invoke(Invocation in) throws Throwable
-   {
-      if (!(in instanceof MethodInvocation))
-      {
-         throw new IllegalArgumentException("TxSyncrhonizationInterceptor.invoke(): invocation not MethodInvocation");
-      }
-      MethodInvocation invocation = (MethodInvocation) in;
-      try
-      {
-         registerTxHandler(invocation);
-         return invocation.invokeNext(); // proceed to next advice or actual call
-      }
-      finally
-      {
-      }
-   }
-
-   private void registerTxHandler(MethodInvocation invocation) throws PojoCacheException
-   {
-      try
-      {
-         // Need to have this in case of rollback
-         PojoTxSynchronizationHandler handler = (PojoTxSynchronizationHandler) synchronizationHandler_.get();
-         if (handler == null)
-         {
-            // First entry point for this transaction scope.
-            Transaction tx = (Transaction) invocation.getMetaData(PojoTxInterceptor.TAG, PojoTxInterceptor.TX);
-            if (tx == null)
-            {
-               throw new IllegalStateException("PojoCache.registerTxHanlder(). Can't have null tx handle.");
-            }
-
-            handler = new PojoTxSynchronizationHandler();
-
-            log.debug("Registering PojoTxSynchronizationHandler for rollback if ncessary " + handler);
-            // Register so we can rollback if necessary
-            tx.registerSynchronization(handler);
-
-            synchronizationHandler_.set(handler);
-         }
-      }
-      catch (RollbackException e)
-      {
-         throw new PojoCacheException("PojoTxUndoSynchronizationInterceptor.registerTxHandler(): Exception: " + e);
-      }
-      catch (SystemException e)
-      {
-         throw new PojoCacheException("PojoTxUndoSynchronizationInterceptor.registerTxHandler(): Exception: " + e);
-      }
-   }
-
-   public static PojoTxSynchronizationHandler getSynchronizationHandler()
-   {
-      return (PojoTxSynchronizationHandler) synchronizationHandler_.get();
-   }
-
-   public static void reset()
-   {
-      synchronizationHandler_.set(null);
-   }
-}

Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/StaticFieldInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/StaticFieldInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/StaticFieldInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,110 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.cache.pojo.interceptors;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.pojo.impl.InternalConstant;
-import org.jboss.cache.pojo.impl.PojoCacheImpl;
-
-import java.lang.reflect.Field;
-
-/**
- * interceptor to intercept for static field replication.
- *
- * @author Ben Wang
- */
-
-public class StaticFieldInterceptor implements Interceptor
-{
-   private final Log log_ = LogFactory.getLog(StaticFieldInterceptor.class);
-   private PojoCacheImpl pCache_;
-   private Fqn fqn_;
-   private String name_;
-   private String key_;
-
-   public StaticFieldInterceptor()
-   {
-   }
-
-   public String getName()
-   {
-      if (name_ == null)
-      {
-         this.name_ = "StaticFieldInterceptor on [" + fqn_ + "]";
-      }
-      return name_;
-   }
-
-   public Object invoke(Invocation invocation) throws Throwable
-   {
-      /*
-      // Kind of ad hoc now. MethodInvocation should not invoke this.
-      if(invocation instanceof MethodInvocation)
-         return invocation.invokeNext();
-
-      needInit(((FieldInvocation)invocation).getField());
-      if (invocation instanceof FieldWriteInvocation)
-      {
-         FieldInvocation fieldInvocation =
-                 (FieldInvocation) invocation;
-
-         Advisor advisor = fieldInvocation.getAdvisor();
-         Field field = fieldInvocation.getField();
-         if(log_.isTraceEnabled())
-         {
-            log_.trace("invoke(): field write interception for fqn: " +fqn_ + " and field: " +field);
-         }
-
-         // Only if this field is replicatable. static, transient and final are not.
-         Object value = ((FieldWriteInvocation) fieldInvocation).getValue();
-
-         cache_.put(fqn_, key_, value);
-         Object obj = fieldInvocation.getTargetObject();
-      } else if (invocation instanceof FieldReadInvocation)
-      {
-         FieldInvocation fieldInvocation =
-                 (FieldInvocation) invocation;
-         Field field = fieldInvocation.getField();
-         Advisor advisor = fieldInvocation.getAdvisor();
-         return cache_.get(fqn_, key_);
-      }
-      */
-      return invocation.invokeNext();
-
-   }
-
-   private void needInit(Field field)
-   {
-      if (pCache_ == null)
-      {
-         String cn = field.getDeclaringClass().getName();
-         fqn_ = Fqn.fromString(InternalConstant.JBOSS_INTERNAL_STATIC + "/" + cn);
-         key_ = field.getName();
-      }
-   }
-
-   boolean isChildOf(Fqn parentFqn)
-   {
-      return fqn_.isChildOf(parentFqn);
-   }
-
-   public Fqn getFqn()
-   {
-      return fqn_;
-   }
-
-   public void setFqn(Fqn fqn)
-   {
-      this.fqn_ = fqn;
-   }
-
-}

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/dynamic/AbstractCollectionInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/dynamic/AbstractCollectionInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/dynamic/AbstractCollectionInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -7,7 +7,7 @@
 
 package org.jboss.cache.pojo.interceptors.dynamic;
 
-import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.proxy.ClassProxy;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.pojo.PojoCacheAlreadyDetachedException;
 import org.jboss.cache.pojo.impl.PojoCacheImpl;
@@ -25,6 +25,7 @@
 {
    Fqn fqn;
    PojoCacheImpl cache;
+   ClassProxy boundProxy;
 
    private boolean attached_ = true;
    private PojoInstance pojoInstance_;
@@ -127,4 +128,14 @@
    abstract Object getCacheCopy();
    abstract void setCurrentCopy(Object obj);
    public abstract Object getCurrentCopy();
+
+   public ClassProxy getBoundProxy()
+   {
+      return boundProxy;
+   }
+
+   public void setBoundProxy(ClassProxy boundProxy)
+   {
+      this.boundProxy = boundProxy;
+   }
 }

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/dynamic/CacheFieldInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/dynamic/CacheFieldInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/dynamic/CacheFieldInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -148,7 +148,7 @@
             }
             else
             {
-               result = pCache_.getObject(fqn_, field.getName(), target);
+               result = pCache_.find(fqn_, field.getName(), target);
 
                // Work around AOP issue with field reads
                if (result != null && result.getClass().isArray())

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/dynamic/CachedMapInterceptor.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/dynamic/CachedMapInterceptor.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/interceptors/dynamic/CachedMapInterceptor.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -7,6 +7,7 @@
 package org.jboss.cache.pojo.interceptors.dynamic;
 
 import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.proxy.ClassProxy;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.pojo.PojoCacheException;
 import org.jboss.cache.pojo.collection.CachedMapImpl;

Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/util/CacheApiUtil.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/util/CacheApiUtil.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/util/CacheApiUtil.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -26,4 +26,6 @@
       Node n = cache.getRoot().getChild(fqn);
       return n != null ? n.getChildren() : null;
    }
+   
+   
 }

Modified: pojo/trunk/src/main/resources/META-INF/pojocache-aop.xml
===================================================================
--- pojo/trunk/src/main/resources/META-INF/pojocache-aop.xml	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/main/resources/META-INF/pojocache-aop.xml	2008-06-26 02:21:26 UTC (rev 6048)
@@ -1,152 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-    This is the PojoCache configuration file that specifies:
-      1. Interceptor stack for API
-      2. Annotation binding for POJO (via "prepare" element)
-
-    Basically, this is a variant of jboss-aop.xml. Note that
-    except for the customization of interceptor stack, you should
-    not need to modify this file.
-
-    To run PojoCache, you will need to define a system property:
-    jboss.aop.path that contains the path to this file such that JBoss Aop
-    can locate it.
+    This is a variant of jboss-aop.xml. 
 -->
 <aop>
-
-   <!--
-   This defines the PojoCache 2.0 interceptor stack. Unless necessary, don't modify the stack here!
-   -->
-
-   <!-- Check id range validity -->
-   <interceptor name="CheckId" class="org.jboss.cache.pojo.interceptors.CheckIdInterceptor"
-                scope="PER_INSTANCE"/>
-
-   <!-- Track Tx undo operation -->
-   <interceptor name="Undo" class="org.jboss.cache.pojo.interceptors.PojoTxUndoInterceptor"
-                scope="PER_INSTANCE"/>
-
-   <!-- Begining of interceptor chain -->
-   <interceptor name="Start" class="org.jboss.cache.pojo.interceptors.PojoBeginInterceptor"
-                scope="PER_INSTANCE">
-   </interceptor>
-
-   <!-- Check if we need a local tx for batch processing -->
-   <interceptor name="Tx" class="org.jboss.cache.pojo.interceptors.PojoTxInterceptor"
-                scope="PER_INSTANCE"/>
-
-   <!--
-      Mockup failed tx for testing. You will need to set PojoFailedTxMockupInterceptor.setRollback(true)
-      to activate it.
-    -->
-   <interceptor name="MockupTx" class="org.jboss.cache.pojo.interceptors.PojoFailedTxMockupInterceptor"
-                scope="PER_INSTANCE"/>
-
-   <!-- Perform parent level node locking -->
-   <interceptor name="TxLock" class="org.jboss.cache.pojo.interceptors.PojoTxLockInterceptor"
-                scope="PER_INSTANCE"/>
-
-   <!-- Interceptor to perform Pojo level rollback -->
-   <interceptor name="TxUndo" class="org.jboss.cache.pojo.interceptors.PojoTxUndoSynchronizationInterceptor"
-                scope="PER_INSTANCE"/>
-
-   <!-- Interceptor to used to check recursive field interception. -->
-   <interceptor name="ReentrantToString" class="org.jboss.cache.pojo.interceptors.MethodReentrancyStopperInterceptor"
-                scope="PER_INSTANCE">
-               <attribute name="MethodName">toString</attribute>
-   </interceptor>
-
-   <interceptor name="ReentrantHashCode" class="org.jboss.cache.pojo.interceptors.MethodReentrancyStopperInterceptor"
-                scope="PER_INSTANCE">
-               <attribute name="MethodName">hashCode</attribute>
-   </interceptor>
-
-   <!-- Whether to allow non-serializable pojo. Default is false. -->
-   <interceptor name="MarshallNonSerializable"
-                class="org.jboss.cache.pojo.interceptors.CheckNonSerializableInterceptor"
-                scope="PER_INSTANCE">
-         <attribute name="marshallNonSerializable">false</attribute>
-                </interceptor>
-
-   <!-- This defines the stack macro -->
-   <stack name="Attach">
-      <interceptor-ref name="Start"/>
-      <interceptor-ref name="CheckId"/>
-      <interceptor-ref name="MarshallNonSerializable"/>
-      <interceptor-ref name="Tx"/>
-      <!-- NOTE: You can comment this out during production although leaving it here is OK. -->
-      <interceptor-ref name="MockupTx"/>
-      <interceptor-ref name="TxLock"/>
-      <interceptor-ref name="TxUndo"/>
-   </stack>
-
-   <stack name="Detach">
-      <interceptor-ref name="Start"/>
-      <interceptor-ref name="CheckId"/>
-      <interceptor-ref name="Tx"/>
-      <!-- NOTE: You can comment this out during production although leaving it here is OK. -->
-      <interceptor-ref name="MockupTx"/>
-      <interceptor-ref name="TxLock"/>
-      <interceptor-ref name="TxUndo"/>
-   </stack>
-
-   <stack name="Find">
-      <interceptor-ref name="Start"/>
-      <interceptor-ref name="CheckId"/>
-   </stack>
-
-   <!--
-      The following section should be READ-ONLY!! It defines the annotation binding to the stack.
-   -->
-
-   <!-- This binds the jointpoint to specific in-memory operations. Currently in PojoUtil. -->
-   <bind pointcut="execution(*
-      @org.jboss.cache.pojo.annotation.Reentrant->toString())">
-      <interceptor-ref name="ReentrantToString"/>
-   </bind>
-
-   <bind pointcut="execution(*
-      @org.jboss.cache.pojo.annotation.Reentrant->hashCode())">
-      <interceptor-ref name="ReentrantHashCode"/>
-   </bind>
-
-   <bind pointcut="execution(*
-      org.jboss.cache.pojo.impl.PojoUtil->@org.jboss.cache.pojo.annotation.TxUndo(..))">
-      <interceptor-ref name="Undo"/>
-   </bind>
-
-   <bind pointcut="execution(* org.jboss.cache.pojo.impl.PojoCacheImpl->@org.jboss.cache.pojo.annotation.Attach(..))">
-      <stack-ref name="Attach"/>
-   </bind>
-
-   <bind pointcut="execution(* org.jboss.cache.pojo.impl.PojoCacheImpl->@org.jboss.cache.pojo.annotation.Detach(..))">
-      <stack-ref name="Detach"/>
-   </bind>
-
-   <bind pointcut="execution(* org.jboss.cache.pojo.impl.PojoCacheImpl->@org.jboss.cache.pojo.annotation.Find(..))">
-      <stack-ref name="Find"/>
-   </bind>
-
-
-   <!--
-      Following is declaration for JDK50 annotation. You use the specific annotation on your
-      POJO such that it can be instrumented. Idea is user will then need only to annotate like:
-        @org.jboss.cache.pojo.annotation.Replicable
-      in his POJO. There will be no need of jboss-aop.xml from user's side.
-      Note that this annotation is inheritant, meaning the subclass will be
-      instrumented as well.
-   -->
-
-   <!-- If a POJO has Replicable annotation, it will be asepectized. -->
-   <!--
+   <!-- If a POJO has a Replicable annotation, it will be asepectized. -->
+   
+   <!-- 
    Supports inheritance and polymorphism. It can either be a concrete class
    or an interface. All sub-classes or interface implementors will be instrumeneted.
    -->
    <prepare expr="field(* $instanceof{@org.jboss.cache.pojo.annotation.Replicable}->*)" />
    
    <!--  Work around that ensures annotated classes which do not access fields are instrumented -->
+   <introduction expr="class($instanceof{@org.jboss.cache.pojo.annotation.Replicable})"/>
 
-
    <!-- Array support -->
    <!-- Comment entire section to disable -->
    <arrayreplacement expr="class($instanceof{@org.jboss.cache.pojo.annotation.Replicable})"/>

Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListImplTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListImplTest.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/collection/CachedListImplTest.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -23,7 +23,7 @@
  */
 
 @Test(groups = {"functional"})
-public class CachedListImplTest 
+public class CachedListImplTest
 {
    Log log = LogFactory.getLog(CachedListImplTest.class);
    PojoCache cache_, cache1_;
@@ -60,15 +60,6 @@
       // proxy now
       list = (List<String>) cache_.find("list");
 
-      // test repl
-      try {
-         cache_.getCache().put(Fqn.fromString("test"), "1", list);
-         fail("Should have a non-serializable exception on list: " +list);
-      } catch (Exception ex)
-      {
-         // OK. It works
-      }
-
       // JBCACHE-975
       list = (List<String>) cache_.detach("list");
 

Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListUndoTest.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ListUndoTest.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -19,7 +19,6 @@
 import org.jboss.aop.proxy.ClassProxy;
 import org.jboss.cache.pojo.PojoCache;
 import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.interceptors.PojoFailedTxMockupInterceptor;
 import org.jboss.cache.pojo.test.Person;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.testng.annotations.AfterMethod;
@@ -60,20 +59,16 @@
 
 //   public void testDummy() {}
 
-   private void setTxRollback(boolean isTrue)
-   {
-      PojoFailedTxMockupInterceptor.TX_ROLLBACK = isTrue;
-   }
-
    public void testSimple() throws Exception
    {
       ArrayList<String> list = new ArrayList<String>();
       list.add("test1");
 
-      setTxRollback(true);
       try
       {
+         tx_mgr.begin();
          cache_.attach("/a", list);
+         tx_mgr.rollback();
       }
       catch (Exception e)
       {
@@ -93,10 +88,11 @@
       list.add("English");
       test.setLanguages(list);
 
-      setTxRollback(true);
       try
       {
+         tx_mgr.begin();
          cache_.attach("/a", test);
+         tx_mgr.rollback();
       }
       catch (Exception e)
       {
@@ -124,10 +120,11 @@
 
       cache_.attach("/a", test);
 
-      setTxRollback(true);
       try
       {
+         tx_mgr.begin();
          cache_.detach("/a");
+         tx_mgr.rollback();
       }
       catch (Exception e)
       {

Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalUndoTest.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/LocalUndoTest.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -18,7 +18,6 @@
 import org.jboss.aop.advice.Interceptor;
 import org.jboss.cache.pojo.PojoCache;
 import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.interceptors.PojoFailedTxMockupInterceptor;
 import org.jboss.cache.pojo.interceptors.dynamic.CacheFieldInterceptor;
 import org.jboss.cache.pojo.test.Person;
 import org.jboss.cache.transaction.DummyTransactionManager;
@@ -60,11 +59,6 @@
 
 //   public void testDummy() {}
 
-   private void setTxRollback(boolean isTrue)
-   {
-      PojoFailedTxMockupInterceptor.TX_ROLLBACK = isTrue;
-   }
-
    public void testSimpleTxWithRollback1() throws Exception
    {
       log_.info("testSimpleTxWithRollback1() ....");
@@ -72,10 +66,11 @@
       test.setName("Ben");
       test.setAge(10);
 
-      setTxRollback(true);
       try
       {
-    	  cache_.attach("/a", test);
+         tx_mgr.begin();
+         cache_.attach("/a", test);
+         tx_mgr.rollback();
       }
       catch (Exception e)
       {
@@ -102,10 +97,11 @@
       test.setAge(10);
       cache_.attach("/a", test);
 
-      setTxRollback(true);
       try
       {
+         tx_mgr.begin();
          cache_.detach("/a");
+         tx_mgr.rollback();
       }
       catch (Exception e)
       {

Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapUndoTest.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/MapUndoTest.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -19,7 +19,6 @@
 import org.jboss.aop.proxy.ClassProxy;
 import org.jboss.cache.pojo.PojoCache;
 import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.interceptors.PojoFailedTxMockupInterceptor;
 import org.jboss.cache.pojo.test.Person;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.testng.annotations.AfterMethod;
@@ -60,20 +59,16 @@
 
 //   public void testDummy() {}
 
-   private void setTxRollback(boolean isTrue)
-   {
-      PojoFailedTxMockupInterceptor.TX_ROLLBACK = isTrue;
-   }
-
    public void testSimple() throws Exception
    {
       HashMap<String, String> map = new HashMap<String, String>();
       map.put("1", "test1");
 
-      setTxRollback(true);
       try
       {
+         tx_mgr.begin();
          cache_.attach("/a", map);
+         tx_mgr.rollback();
       }
       catch (Exception e)
       {
@@ -93,10 +88,11 @@
       map.put("1", "English");
       test.setHobbies(map);
 
-      setTxRollback(true);
       try
       {
+         tx_mgr.begin();
          cache_.attach("/a", test);
+         tx_mgr.rollback();
       }
       catch (Exception e)
       {
@@ -124,10 +120,11 @@
 
       cache_.attach("/a", test);
 
-      setTxRollback(true);
       try
       {
+         tx_mgr.begin();
          cache_.detach("/a");
+         tx_mgr.rollback();
       }
       catch (Exception e)
       {

Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ReplicatedTxTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ReplicatedTxTest.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/ReplicatedTxTest.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -242,17 +242,19 @@
             {
                TestingUtil.sleepThread(1000); // give Thread1 time to createPerson
                List<String> lang = ((Person) cache1.find("/person/test6")).getLanguages();
+               System.out.println(lang == null);
                tx = getTransaction();
                tx.begin();
                lang.add("English");
                tx.commit();
+               System.out.println("Successful!");
             }
             catch (RollbackException rollback)
             {
-               ;
             }
             catch (Exception ex)
             {
+               ex.printStackTrace();
                try
                {
                   tx.rollback();

Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetUndoTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetUndoTest.java	2008-06-25 18:35:22 UTC (rev 6047)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/rollback/SetUndoTest.java	2008-06-26 02:21:26 UTC (rev 6048)
@@ -19,7 +19,6 @@
 import org.jboss.aop.proxy.ClassProxy;
 import org.jboss.cache.pojo.PojoCache;
 import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.interceptors.PojoFailedTxMockupInterceptor;
 import org.jboss.cache.pojo.test.Person;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.testng.annotations.AfterMethod;
@@ -58,22 +57,16 @@
       cache_.stop();
    }
 
-//   public void testDummy() {}
-
-   private void setTxRollback(boolean isTrue)
-   {
-      PojoFailedTxMockupInterceptor.TX_ROLLBACK = isTrue;
-   }
-
    public void testSimple() throws Exception
    {
       HashSet<String> set = new HashSet<String>();
       set.add("test1");
 
-      setTxRollback(true);
       try
       {
+         tx_mgr.begin();
          cache_.attach("/a", set);
+         tx_mgr.rollback();
       }
       catch (Exception e)
       {
@@ -93,10 +86,11 @@
       set.add("English");
       test.setSkills(set);
 
-      setTxRollback(true);
       try
       {
+         tx_mgr.begin();
          cache_.attach("/a", test);
+         tx_mgr.rollback();
       } catch (Exception e)
       {
       }
@@ -123,10 +117,11 @@
 
       cache_.attach("/a", test);
 
-      setTxRollback(true);
       try
       {
+         tx_mgr.begin();
          cache_.detach("/a");
+         tx_mgr.rollback();
       } catch (Exception e)
       {
       }




More information about the jbosscache-commits mailing list