Author: jason.greene(a)jboss.com
Date: 2007-12-20 19:31:34 -0500 (Thu, 20 Dec 2007)
New Revision: 4902
Modified:
core/branches/1.4.X/src/org/jboss/cache/aop/TreeCacheAopDelegate.java
Log:
Fix PCACHE-58
Modified: core/branches/1.4.X/src/org/jboss/cache/aop/TreeCacheAopDelegate.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/aop/TreeCacheAopDelegate.java 2007-12-20
22:17:08 UTC (rev 4901)
+++ core/branches/1.4.X/src/org/jboss/cache/aop/TreeCacheAopDelegate.java 2007-12-21
00:31:34 UTC (rev 4902)
@@ -587,35 +587,34 @@
protected void _regularRemoveObject(Fqn fqn, boolean removeCacheInterceptor, Object
result, Class clazz,
boolean evict) throws CacheException
{
- InstanceAdvisor advisor = ((Advised) result)._getInstanceAdvisor();
+ Advised advised = ((Advised) result);
+ InstanceAdvisor advisor = advised._getInstanceAdvisor();
+ Advisor advisorAdvisor = advised._getAdvisor();
CachedType type = cache_.getCachedType(clazz);
for (Iterator i = type.getFieldsIterator(); i.hasNext();) {
Field field = (Field) i.next();
Object value = null;
- try {
- value=field.get(result);
- }
- catch(IllegalAccessException e) {
- throw new CacheException("field access failed", e);
- }
CachedType fieldType = cache_.getCachedType(field.getType());
- if (!fieldType.isImmediate()) {
- _removeObject(new Fqn(fqn, field.getName()), removeCacheInterceptor, evict);
+ if (fieldType.isImmediate()|| CachedType.hasSerializableAnnotation(field,
advisorAdvisor)) {
+ value = cache_.get(fqn, field.getName());
+ } else {
+ value = _removeObject(new Fqn(fqn, field.getName()), removeCacheInterceptor,
evict);
}
// Check for Collection field so we need to restore the original reference.
if(value instanceof ClassProxy)
{
Interceptor interceptor =
CollectionInterceptorUtil.getInterceptor((ClassProxy)value);
- Object ori =
((AbstractCollectionInterceptor)interceptor).getOriginalInstance();
- try {
- field.set(result, ori);
- } catch (IllegalAccessException e) {
- throw new CacheException("field access failed", e);
- }
+ value = ((AbstractCollectionInterceptor)interceptor).getOriginalInstance();
}
+
+ try {
+ field.set(result, value);
+ } catch (IllegalAccessException e) {
+ throw new CacheException("field access failed", e);
+ }
}
// batch remove
Show replies by date