From: Ben W. <bw...@jb...> - 2006-07-07 10:26:13
|
User: bwang Date: 06/07/07 06:26:07 Modified: src-50/org/jboss/cache/pojo CachedType.java CollectionClassHandler.java ObjectGraphHandler.java TreeCacheAopDelegate.java Removed: src-50/org/jboss/cache/pojo BaseInterceptor.java CacheInterceptor.java Log: Relocated the dynamic interceptors Revision Changes Path 1.3 +5 -5 JBossCache/src-50/org/jboss/cache/pojo/CachedType.java (In the diff below, changes in quantity of whitespace are not shown.) Index: CachedType.java =================================================================== RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/CachedType.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- CachedType.java 27 Jun 2006 05:25:43 -0000 1.2 +++ CachedType.java 7 Jul 2006 10:26:07 -0000 1.3 @@ -49,7 +49,7 @@ Character.TYPE, Class.class})); - private WeakReference type; + private WeakReference<Class> type; private boolean immutable; private boolean immediate; // This map caches the class that contains no annotation. @@ -66,7 +66,7 @@ public CachedType(Class type) { - this.type = new WeakReference(type); + this.type = new WeakReference<Class>(type); analyze(); } @@ -221,7 +221,7 @@ * We check whether this class has any field annotation declaration. We assume that there is only * one such declaring class per vm and it is static. */ - static boolean hasAnnotation(Class clazz, Advisor advisor, CachedType type) + public static boolean hasAnnotation(Class clazz, Advisor advisor, CachedType type) { // It is ok that we don't synchronize it here. if (CachedClassWithNoAnnotation_.get(clazz) != null) @@ -255,7 +255,7 @@ return false; } - static boolean isPrimitiveNonReplicatable(Field f) + public static boolean isPrimitiveNonReplicatable(Field f) { int mods = f.getModifiers(); /** @@ -293,7 +293,7 @@ return hasTransientAnnotation(field, advisor) || hasSerializableAnnotation(field, advisor); } - static boolean hasTransientAnnotation(Field field, Advisor advisor) + public static boolean hasTransientAnnotation(Field field, Advisor advisor) { Object obj = advisor.resolveAnnotation(field, org.jboss.cache.aop.annotation.Transient.class); if (obj != null) 1.6 +7 -6 JBossCache/src-50/org/jboss/cache/pojo/CollectionClassHandler.java (In the diff below, changes in quantity of whitespace are not shown.) Index: CollectionClassHandler.java =================================================================== RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/CollectionClassHandler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- CollectionClassHandler.java 6 Jul 2006 09:25:40 -0000 1.5 +++ CollectionClassHandler.java 7 Jul 2006 10:26:07 -0000 1.6 @@ -13,10 +13,10 @@ import org.jboss.aop.proxy.ClassProxy; import org.jboss.cache.CacheException; import org.jboss.cache.Fqn; -import org.jboss.cache.pojo.collection.AbstractCollectionInterceptor; +import org.jboss.cache.pojo.interceptors.dynamic.AbstractCollectionInterceptor; import org.jboss.cache.pojo.collection.CollectionInterceptorUtil; +import org.jboss.cache.pojo.interceptors.dynamic.BaseInterceptor; -import java.lang.reflect.Field; import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -28,7 +28,7 @@ * * @author Ben Wang * Date: Aug 4, 2005 - * @version $Id: CollectionClassHandler.java,v 1.5 2006/07/06 09:25:40 bwang Exp $ + * @version $Id: CollectionClassHandler.java,v 1.6 2006/07/07 10:26:07 bwang Exp $ */ class CollectionClassHandler { @@ -216,14 +216,15 @@ if (isCollection) { // Always initialize the ref count so that we can mark this as an AopNode. - AOPInstance aopInstance = internal_.initializeAopInstance(); + AOPInstance aopInstance = InternalDelegate.initializeAopInstance(); cache_.put(fqn, AOPInstance.KEY, aopInstance); // Attach aopInstance to that interceptor - BaseInterceptor baseInterceptor = (BaseInterceptor) CollectionInterceptorUtil.getInterceptor((ClassProxy) obj); + BaseInterceptor baseInterceptor = (BaseInterceptor) CollectionInterceptorUtil.getInterceptor( + (ClassProxy) obj); baseInterceptor.setAopInstance(aopInstance); - internal_.setPojo(aopInstance, obj); + InternalDelegate.setPojo(aopInstance, obj); } return isCollection; } 1.5 +5 -3 JBossCache/src-50/org/jboss/cache/pojo/ObjectGraphHandler.java (In the diff below, changes in quantity of whitespace are not shown.) Index: ObjectGraphHandler.java =================================================================== RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/ObjectGraphHandler.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- ObjectGraphHandler.java 6 Jul 2006 09:25:40 -0000 1.4 +++ ObjectGraphHandler.java 7 Jul 2006 10:26:07 -0000 1.5 @@ -14,15 +14,17 @@ import org.jboss.aop.advice.Interceptor; import org.jboss.cache.CacheException; import org.jboss.cache.Fqn; -import org.jboss.cache.pojo.collection.AbstractCollectionInterceptor; +import org.jboss.cache.pojo.interceptors.dynamic.AbstractCollectionInterceptor; import org.jboss.cache.pojo.util.AopUtil; +import org.jboss.cache.pojo.interceptors.dynamic.BaseInterceptor; +import org.jboss.cache.pojo.interceptors.dynamic.CacheInterceptor; /** * Handle the object graph management. * * @author Ben Wang * Date: Aug 4, 2005 - * @version $Id: ObjectGraphHandler.java,v 1.4 2006/07/06 09:25:40 bwang Exp $ + * @version $Id: ObjectGraphHandler.java,v 1.5 2006/07/07 10:26:07 bwang Exp $ */ class ObjectGraphHandler { @@ -206,7 +208,7 @@ aliasFqn = internal_.createIndirectFqn(refFqn.toString()); } else { - aliasFqn = internal_.getIndirectFqn(refFqn.toString()); + aliasFqn = InternalDelegate.getIndirectFqn(refFqn.toString()); } // set the internal fqn in fqn so we can reference it. if (log.isTraceEnabled()) 1.7 +8 -6 JBossCache/src-50/org/jboss/cache/pojo/TreeCacheAopDelegate.java (In the diff below, changes in quantity of whitespace are not shown.) Index: TreeCacheAopDelegate.java =================================================================== RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/TreeCacheAopDelegate.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -b -r1.6 -r1.7 --- TreeCacheAopDelegate.java 7 Jul 2006 09:34:42 -0000 1.6 +++ TreeCacheAopDelegate.java 7 Jul 2006 10:26:07 -0000 1.7 @@ -16,9 +16,11 @@ import org.jboss.aop.proxy.ClassProxy; import org.jboss.cache.CacheException; import org.jboss.cache.Fqn; -import org.jboss.cache.pojo.collection.AbstractCollectionInterceptor; +import org.jboss.cache.pojo.interceptors.dynamic.AbstractCollectionInterceptor; import org.jboss.cache.pojo.memory.FieldPersistentReference; import org.jboss.cache.pojo.util.AopUtil; +import org.jboss.cache.pojo.interceptors.dynamic.BaseInterceptor; +import org.jboss.cache.pojo.interceptors.dynamic.CacheInterceptor; import java.lang.reflect.Field; import java.util.Collection; @@ -42,7 +44,7 @@ private CollectionClassHandler collectionHandler_; private SerializableObjectHandler serializableHandler_; // Use ThreadLocal to hold a boolean isBulkRemove - private ThreadLocal bulkRemove_ = new ThreadLocal(); + private ThreadLocal<Boolean> bulkRemove_ = new ThreadLocal<Boolean>(); private final String DETACH = "DETACH"; private PojoUtil util_ = new PojoUtil(); @@ -151,7 +153,7 @@ } } - internal_.setPojo(aopInstance, obj); + InternalDelegate.setPojo(aopInstance, obj); return obj; } @@ -413,7 +415,7 @@ // Let's do batch update via Map instead Map map = new HashMap(); // Always initialize the ref count so we can mark this as an AopNode. - AOPInstance aopInstance = internal_.initializeAopInstance(); + AOPInstance aopInstance = InternalDelegate.initializeAopInstance(); // Insert interceptor at runtime CacheInterceptor interceptor = new CacheInterceptor(cache_, fqn, type); interceptor.setAopInstance(aopInstance); @@ -421,7 +423,7 @@ map.put(AOPInstance.KEY, aopInstance); // This is put into map first. - internal_.putAopClazz(type.getType(), map); + InternalDelegate.putAopClazz(type.getType(), map); // we will do it recursively. // Map of sub-objects that are non-primitive Map subPojoMap = new HashMap(); @@ -470,7 +472,7 @@ // Use option to skip locking since we have parent lock already. cache_.put(fqn, map, internal_.getLockOption()); // This is in-memory operation only - internal_.setPojo(aopInstance, obj); + InternalDelegate.setPojo(aopInstance, obj); for (Object o : subPojoMap.keySet()) { |