[jboss-cvs] JBossCache/src-50/org/jboss/cache/pojo/impl ...
Manik Surtani
msurtani at jboss.com
Thu Jan 4 00:35:40 EST 2007
User: msurtani
Date: 07/01/04 00:35:40
Modified: src-50/org/jboss/cache/pojo/impl PojoCacheDelegate.java
Log:
Major changes around nodes, and the way they interact with the interceptor stack.
Also removed redundant methods in NodeSPI and removed the need for casting to NodeSPI in most cases.
Revision Changes Path
1.20 +26 -20 JBossCache/src-50/org/jboss/cache/pojo/impl/PojoCacheDelegate.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PojoCacheDelegate.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/impl/PojoCacheDelegate.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- PojoCacheDelegate.java 3 Jan 2007 08:55:37 -0000 1.19
+++ PojoCacheDelegate.java 4 Jan 2007 05:35:40 -0000 1.20
@@ -17,12 +17,12 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
-import org.jboss.cache.config.Option;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.pojo.CachedType;
+import org.jboss.cache.pojo.PojoCacheException;
import org.jboss.cache.pojo.PojoInstance;
import org.jboss.cache.pojo.PojoReference;
import org.jboss.cache.pojo.PojoUtil;
-import org.jboss.cache.pojo.PojoCacheException;
import org.jboss.cache.pojo.collection.CollectionInterceptorUtil;
import org.jboss.cache.pojo.interceptors.dynamic.AbstractCollectionInterceptor;
import org.jboss.cache.pojo.interceptors.dynamic.BaseInterceptor;
@@ -151,7 +151,7 @@
if (obj == null)
{
- return oldValue; // we are done
+ return oldValue;// we are done
}
// This create a PojoReference to store a pointer to the real fqn.
@@ -216,19 +216,17 @@
private void createChildNodeFirstWithoutLocking(Fqn internalFqn)
{
- Option option = cache_.getInvocationContext().getOptionOverrides();
int size = internalFqn.size();
Fqn f = internalFqn.getFqnChild(0, size - 1);
Fqn child = internalFqn.getFqnChild(size - 1, size);
- option.setBypassInterceptorChain(true);
- Node base = cache_.getRoot().getChild(f);
+
+ NodeSPI base = cache_.getRoot().getChildDirect(f);
if (base == null)
{
log.debug("The node retrieved is null from fqn: " + f);
return;
}
- option.setBypassInterceptorChain(true);
- base.addChild(child);
+ base.addChildDirect(child);
}
/**
@@ -283,7 +281,7 @@
internal_.cleanUp(internalFqn);
}
else
- { // Just Serializable objects. Do a brute force remove is ok.
+ {// Just Serializable objects. Do a brute force remove is ok.
serializableHandler_.remove();
internal_.cleanUp(internalFqn);
}
@@ -301,7 +299,7 @@
Object pojo = getObject(fqn);
if (pojo != null)
{
- map.put(fqn, pojo); // we are done!
+ map.put(fqn, pojo);// we are done!
return map;
}
@@ -351,7 +349,7 @@
obj = advisedHandler_.get(internalFqn, clazz, pojoInstance);
}
else if (isCollectionGet(clazz))
- { // Must be Collection classes. We will use aop.ClassProxy instance instead.
+ {// Must be Collection classes. We will use aop.ClassProxy instance instead.
obj = collectionHandler_.get(internalFqn, clazz, pojoInstance);
}
else
@@ -367,7 +365,9 @@
private boolean isCollectionGet(Class clazz)
{
if (Map.class.isAssignableFrom(clazz) || Collection.class.isAssignableFrom(clazz))
+ {
return true;
+ }
return false;
}
@@ -380,7 +380,9 @@
{
InstanceAdvisor advisor = ((Advised) obj)._getInstanceAdvisor();
if (advisor == null)
+ {
throw new PojoCacheException("_putObject(): InstanceAdvisor is null for: " + obj);
+ }
// Step Check for cross references
interceptor = AopUtil.findCacheInterceptor(advisor);
@@ -422,7 +424,7 @@
}
else
{
- cache_.removeNode(fqn); // interceptor has been removed so it is safe to do bulk remove now.
+ cache_.removeNode(fqn);// interceptor has been removed so it is safe to do bulk remove now.
}
return true;
}
@@ -486,7 +488,9 @@
// add interceptor
InstanceAdvisor advisor = ((Advised) obj)._getInstanceAdvisor();
if (advisor == null)
+ {
throw new PojoCacheException("pojoGraphMultipleReferenced(): InstanceAdvisor is null for: " + obj);
+ }
BaseInterceptor interceptor = (BaseInterceptor) AopUtil.findCacheInterceptor(advisor);
// just in case
@@ -496,8 +500,8 @@
}
PojoInstance pojoInstance = interceptor.getAopInstance();
// Check if there is cross referenced.
- if (pojoInstance.getRefCount() != 0) return true; // I have been referenced
- if (pojoInstance.getInternalFqn() != null) return true; // I am referencing others
+ if (pojoInstance.getRefCount() != 0) return true;// I have been referenced
+ if (pojoInstance.getInternalFqn() != null) return true;// I am referencing others
boolean hasFieldAnnotation = hasAnnotation(obj.getClass(), ((Advised) obj)._getAdvisor(), type);
// Check the fields
@@ -540,9 +544,11 @@
// Need to do a getObject just in case this is a failover removeObject.
if (value == null)
+ {
value = getObject(new Fqn(interceptor.getFqn(), field.getName()));
+ }
- if (value == null) continue; // this is no brainer.
+ if (value == null) continue;// this is no brainer.
if (pojoGraphMultipleReferenced(value, undoMap)) return true;
}
@@ -557,10 +563,10 @@
InstanceAdvisor advisor = ((ClassProxy) obj)._getInstanceAdvisor();
BaseInterceptor interceptor = (BaseInterceptor) AopUtil.findCollectionInterceptor(advisor);
PojoInstance pojoInstance = interceptor.getAopInstance();
- if (pojoInstance == null) return false; // safeguard
+ if (pojoInstance == null) return false;// safeguard
// Check if there is cross referenced.
- if (pojoInstance.getRefCount() != 0) return true; // I have been referenced
- if (pojoInstance.getInternalFqn() != null) return true; // I am referencing others
+ if (pojoInstance.getRefCount() != 0) return true;// I have been referenced
+ if (pojoInstance.getInternalFqn() != null) return true;// I am referencing others
// iterate thru the keys
if (obj instanceof Map)
{
@@ -580,7 +586,7 @@
}
// Don't remove now.
boolean removeFromCache = false;
- ((AbstractCollectionInterceptor) interceptor).detach(removeFromCache); // detach the interceptor. This will trigger a copy and remove.
+ ((AbstractCollectionInterceptor) interceptor).detach(removeFromCache);// detach the interceptor. This will trigger a copy and remove.
boolean detachOnly = true;
detachInterceptor(advisor, interceptor, detachOnly, undoMap);
}
@@ -606,7 +612,7 @@
for (Node n : col)
{
Fqn newFqn = n.getFqn();
- if (InternalHelper.isInternalNode(newFqn)) continue; // skip
+ if (InternalHelper.isInternalNode(newFqn)) continue;// skip
Object pojo = getObject(newFqn);
if (pojo != null)
More information about the jboss-cvs-commits
mailing list