[jboss-cvs] JBossCache/src/org/jboss/cache/aop ...
Manik Surtani
msurtani at belmont.prod.atl2.jboss.com
Wed Aug 30 13:08:17 EDT 2006
User: msurtani
Date: 06/08/30 13:08:17
Modified: src/org/jboss/cache/aop TreeCacheAopDelegate.java
Log:
Java5 optimisations
Revision Changes Path
1.77 +201 -142 JBossCache/src/org/jboss/cache/aop/TreeCacheAopDelegate.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TreeCacheAopDelegate.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/aop/TreeCacheAopDelegate.java,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- TreeCacheAopDelegate.java 25 Aug 2006 14:10:07 -0000 1.76
+++ TreeCacheAopDelegate.java 30 Aug 2006 17:08:17 -0000 1.77
@@ -21,9 +21,9 @@
import org.jboss.cache.aop.collection.AbstractCollectionInterceptor;
import org.jboss.cache.aop.references.FieldPersistentReference;
import org.jboss.cache.aop.util.AopUtil;
+import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jboss.cache.marshall.MethodCall;
import java.lang.reflect.Field;
import java.util.Collection;
@@ -35,12 +35,13 @@
/**
* Delegate class for PojoCache.
+ *
* @author Ben Wang
*/
public class TreeCacheAopDelegate
{
protected PojoCache cache_;
- protected final static Log log=LogFactory.getLog(TreeCacheAopDelegate.class);
+ protected final static Log log = LogFactory.getLog(TreeCacheAopDelegate.class);
protected InternalDelegate internal_;
protected ObjectGraphHandler graphHandler_;
protected CollectionClassHandler collectionHandler_;
@@ -65,14 +66,15 @@
public boolean getBulkRemove()
{
- return ((Boolean)bulkRemove_.get()).booleanValue();
+ return ((Boolean) bulkRemove_.get()).booleanValue();
}
protected Object _getObject(Fqn fqn) throws CacheException
{
// TODO Must we really to couple with BR? JBCACHE-669
Object pojo = internal_.getPojoWithGravitation(fqn);
- if ( pojo != null) {
+ if (pojo != null)
+ {
// we already have an advised instance
return pojo;
}
@@ -111,21 +113,24 @@
Object obj;
// Check for both Advised and Collection classes for object graph.
- if( (obj = graphHandler_.objectGraphGet(fqn)) != null )
+ if ((obj = graphHandler_.objectGraphGet(fqn)) != null)
return obj; // retrieved from internal ref node. We are done.
AOPInstance aopInstance = internal_.getAopInstance(fqn);
- if(aopInstance == null)
+ if (aopInstance == null)
{
throw new RuntimeException("TreeCacheAopDelegate._getObject(): null AOPInstance.");
}
- if (Advised.class.isAssignableFrom(clazz)) {
- try {
+ if (Advised.class.isAssignableFrom(clazz))
+ {
+ try
+ {
obj = clazz.newInstance();
// TODO Need to populate the object from the cache as well.
}
- catch(Exception e) {
+ catch (Exception e)
+ {
throw new CacheException("failed creating instance of " + clazz.getName(), e);
}
// Insert interceptor at runtime
@@ -135,15 +140,22 @@
advisor.appendInterceptor(interceptor);
cache_.addUndoInterceptor(advisor, interceptor, ModificationEntry.INTERCEPTOR_ADD);
- } else { // Must be Collection classes. We will use aop.ClassProxy instance instead.
- try {
- if( (obj = collectionHandler_.collectionObjectGet(fqn, clazz)) != null ) {
- } else {
+ }
+ else
+ { // Must be Collection classes. We will use aop.ClassProxy instance instead.
+ try
+ {
+ if ((obj = collectionHandler_.collectionObjectGet(fqn, clazz)) != null)
+ {
+ }
+ else
+ {
// Maybe it is just a serialized object.
- obj=serializableHandler_.serializableObjectGet(fqn);
+ obj = serializableHandler_.serializableObjectGet(fqn);
}
}
- catch(Exception e) {
+ catch (Exception e)
+ {
throw new CacheException("failure creating proxy", e);
}
}
@@ -154,6 +166,7 @@
/**
* Note that caller of this method will take care of synchronization within the <code>fqn</code> sub-tree.
+ *
* @param fqn
* @param obj
* @return
@@ -161,17 +174,18 @@
*/
protected Object _putObject(Fqn fqn, Object obj) throws CacheException
{
- if(!cache_.isMarshallNonSerializable())
+ if (!cache_.isMarshallNonSerializable())
AopUtil.checkObjectType(obj);
- if (obj == null) {
+ if (obj == null)
+ {
return cache_._removeObject(fqn, true);
}
// Skip some un-necessary update if obj is the same class as the old one
Object oldValue = internal_.getPojo(fqn);
- if(oldValue == obj) return obj; // value already in cache. return right away.
+ if (oldValue == obj) return obj; // value already in cache. return right away.
- if(oldValue != null)
+ if (oldValue != null)
{
// Trigger bulk remove here for performance
setBulkRemove(true);
@@ -179,22 +193,25 @@
}
// Remember not to print obj here since it will trigger the CacheInterceptor.
- if(log.isDebugEnabled()) {
+ if (log.isDebugEnabled())
+ {
log.debug("putObject(): fqn: " + fqn);
}
// store object in cache
- if (obj instanceof Advised) {
+ if (obj instanceof Advised)
+ {
CachedType type = cache_.getCachedType(obj.getClass());
// add interceptor
InstanceAdvisor advisor = ((Advised) obj)._getInstanceAdvisor();
- if(advisor == null)
- throw new RuntimeException("_putObject(): InstanceAdvisor is null for: " +obj);
+ if (advisor == null)
+ throw new RuntimeException("_putObject(): InstanceAdvisor is null for: " + obj);
// Step Check for cross references
Interceptor interceptor = AopUtil.findCacheInterceptor(advisor);
// Let's check for object graph, e.g., multiple and circular references first
- if (graphHandler_.objectGraphPut(fqn, interceptor, type, obj)) { // found cross references
+ if (graphHandler_.objectGraphPut(fqn, interceptor, type, obj))
+ { // found cross references
return oldValue;
}
@@ -206,14 +223,19 @@
* First check if obj has been aspectized? That is, if it is a ClassProxy or not.
* If not, we will need to create a proxy first for the Collection classes
*/
- } else if (collectionHandler_.collectionObjectPut(fqn, obj)) {
+ }
+ else if (collectionHandler_.collectionObjectPut(fqn, obj))
+ {
//
- } else if (serializableHandler_.serializableObjectPut(fqn, obj)) {
+ }
+ else if (serializableHandler_.serializableObjectPut(fqn, obj))
+ {
// must be Serializable, including primitive types
- } else
+ }
+ else
{
// I really don't know what this is.
- throw new RuntimeException("putObject(): obj: " +obj + " type is not recognizable.");
+ throw new RuntimeException("putObject(): obj: " + obj + " type is not recognizable.");
}
return oldValue;
@@ -223,16 +245,18 @@
* Based on the pojo to perform a bulk remove recursively if there is no object graph
* relationship for performance optimization.
*/
- protected boolean bulkRemove(Fqn fqn, Object obj) throws CacheException {
+ protected boolean bulkRemove(Fqn fqn, Object obj) throws CacheException
+ {
// Check for cross-reference. If there is, we can't do bulk remove
// map contains (pojo, cacheinterceptor) pair that needs to undo the the removal.
// return false;
Map undoMap = new HashMap();
- if(pojoGraphMultipleReferenced(obj, undoMap))
+ if (pojoGraphMultipleReferenced(obj, undoMap))
{
undoInterceptorDetach(undoMap);
return false;
- } else
+ }
+ else
{
cache_.remove(fqn); // interceptor has been removed so it is safe to do bulk remove now.
}
@@ -242,11 +266,12 @@
protected void detachInterceptor(InstanceAdvisor advisor, Interceptor interceptor,
boolean detachOnly, Map undoMap)
{
- if(!detachOnly)
+ if (!detachOnly)
{
advisor.removeInterceptor(interceptor.getName());
undoMap.put(advisor, interceptor);
- } else
+ }
+ else
{
undoMap.put(DETACH, interceptor);
}
@@ -254,26 +279,27 @@
protected void undoInterceptorDetach(Map undoMap)
{
- for(Iterator it = undoMap.keySet().iterator(); it.hasNext();)
+ for (Iterator it = undoMap.keySet().iterator(); it.hasNext();)
{
Object obj = it.next();
- if(obj instanceof InstanceAdvisor)
+ if (obj instanceof InstanceAdvisor)
{
- InstanceAdvisor advisor = (InstanceAdvisor)obj;
- BaseInterceptor interceptor = (BaseInterceptor)undoMap.get(advisor);
+ InstanceAdvisor advisor = (InstanceAdvisor) obj;
+ BaseInterceptor interceptor = (BaseInterceptor) undoMap.get(advisor);
- if(interceptor == null)
+ if (interceptor == null)
{
throw new IllegalStateException("TreeCacheAopDelegate.undoInterceptorDetach(): null interceptor");
}
advisor.appendInterceptor(interceptor);
- } else
+ }
+ else
{
- BaseInterceptor interceptor = (BaseInterceptor)undoMap.get(obj);
+ BaseInterceptor interceptor = (BaseInterceptor) undoMap.get(obj);
boolean copyToCache = false;
- ((AbstractCollectionInterceptor)interceptor).attach(null, copyToCache);
+ ((AbstractCollectionInterceptor) interceptor).attach(null, copyToCache);
}
}
}
@@ -282,35 +308,40 @@
* Check recursively if the pojo and its graph is multiple referenced. If it is, we can't
* do a bulk remove.
*/
- protected boolean pojoGraphMultipleReferenced(Object obj, Map undoMap) throws CacheException {
+ protected boolean pojoGraphMultipleReferenced(Object obj, Map undoMap) throws CacheException
+ {
// store object in cache
- if (obj instanceof Advised) {
+ if (obj instanceof Advised)
+ {
CachedType type = cache_.getCachedType(obj.getClass());
// add interceptor
InstanceAdvisor advisor = ((Advised) obj)._getInstanceAdvisor();
- if(advisor == null)
- throw new RuntimeException("pojoGraphMultipleReferenced(): InstanceAdvisor is null for: " +obj);
+ if (advisor == null)
+ throw new RuntimeException("pojoGraphMultipleReferenced(): InstanceAdvisor is null for: " + obj);
- BaseInterceptor interceptor = (BaseInterceptor)AopUtil.findCacheInterceptor(advisor);
+ BaseInterceptor interceptor = (BaseInterceptor) AopUtil.findCacheInterceptor(advisor);
// just in case
- if(interceptor == null)
+ if (interceptor == null)
{
return false;
}
AOPInstance aopInstance = interceptor.getAopInstance();
// Check if there is cross referenced.
- if(aopInstance.getRefCount() != 0) return true; // I have been referenced
- if(aopInstance.getRefFqn() != null) return true; // I am referencing others
+ if (aopInstance.getRefCount() != 0) return true; // I have been referenced
+ if (aopInstance.getRefFqn() != null) return true; // I am referencing others
- boolean hasFieldAnnotation = hasAnnotation(obj.getClass(), ((Advised)obj)._getAdvisor(), type);
+ boolean hasFieldAnnotation = hasAnnotation(obj.getClass(), ((Advised) obj)._getAdvisor(), type);
// Check the fields
- for (Iterator i = type.getFields().iterator(); i.hasNext();) {
- Field field = (Field)(((FieldPersistentReference) i.next())).get();
+ for (Iterator i = type.getFields().iterator(); i.hasNext();)
+ {
+ Field field = (Field) (((FieldPersistentReference) i.next())).get();
Object value = null;
- try {
- value=field.get(obj);
+ try
+ {
+ value = field.get(obj);
}
- catch(IllegalAccessException e) {
+ catch (IllegalAccessException e)
+ {
throw new CacheException("field access failed", e);
}
@@ -319,66 +350,68 @@
// we simply treat field that has @Serializable as a primitive type.
if (fieldType.isImmediate() ||
(hasFieldAnnotation &&
- CachedType.hasSerializableAnnotation(field, ((Advised)obj)._getAdvisor())))
+ CachedType.hasSerializableAnnotation(field, ((Advised) obj)._getAdvisor())))
{
continue;
}
// check for non-replicatable types
- if(CachedType.isPrimitiveNonReplicatable(field))
+ if (CachedType.isPrimitiveNonReplicatable(field))
{
continue;
}
- if(!hasFieldAnnotation)
+ if (!hasFieldAnnotation)
{
- if(CachedType.hasTransientAnnotation(field, ((Advised)obj)._getAdvisor()))
+ if (CachedType.hasTransientAnnotation(field, ((Advised) obj)._getAdvisor()))
{
continue;
}
}
// Need to do a getObject just in case this is a failover removeObject.
- if(value == null)
+ 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;
+ if (pojoGraphMultipleReferenced(value, undoMap)) return true;
}
boolean detachOnly = false;
detachInterceptor(advisor, interceptor, detachOnly, undoMap);
- } else if (obj instanceof Map || obj instanceof List || obj instanceof Set)
+ }
+ else if (obj instanceof Map || obj instanceof List || obj instanceof Set)
{
// TODO Is this really necessary?
- if(!(obj instanceof ClassProxy)) return false;
+ if (!(obj instanceof ClassProxy)) return false;
- InstanceAdvisor advisor = ((ClassProxy)obj)._getInstanceAdvisor();
- BaseInterceptor interceptor = (BaseInterceptor)AopUtil.findCollectionInterceptor(advisor);
+ InstanceAdvisor advisor = ((ClassProxy) obj)._getInstanceAdvisor();
+ BaseInterceptor interceptor = (BaseInterceptor) AopUtil.findCollectionInterceptor(advisor);
AOPInstance aopInstance = interceptor.getAopInstance();
- if(aopInstance == null) return false; // safeguard
+ if (aopInstance == null) return false; // safeguard
// Check if there is cross referenced.
- if(aopInstance.getRefCount() != 0) return true; // I have been referenced
- if(aopInstance.getRefFqn() != null) return true; // I am referencing others
+ if (aopInstance.getRefCount() != 0) return true; // I have been referenced
+ if (aopInstance.getRefFqn() != null) return true; // I am referencing others
// iterate thru the keys
- if(obj instanceof Map)
+ if (obj instanceof Map)
{
- for(Iterator it = ((Map)obj).keySet().iterator(); it.hasNext();)
+ for (Iterator it = ((Map) obj).keySet().iterator(); it.hasNext();)
{
- Object subObj = ((Map)obj).get(it.next());
- if(pojoGraphMultipleReferenced(subObj, undoMap)) return true;
+ Object subObj = ((Map) obj).get(it.next());
+ if (pojoGraphMultipleReferenced(subObj, undoMap)) return true;
+ }
}
- } else if (obj instanceof List || obj instanceof Set)
+ else if (obj instanceof List || obj instanceof Set)
{
- for(Iterator it = ((Collection)obj).iterator(); it.hasNext();)
+ for (Iterator it = ((Collection) obj).iterator(); it.hasNext();)
{
Object subObj = it.next();
- if(pojoGraphMultipleReferenced(subObj, undoMap)) return true;
+ if (pojoGraphMultipleReferenced(subObj, undoMap)) return true;
}
}
// 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);
}
@@ -389,7 +422,8 @@
protected void _regularPutObject(Fqn fqn, Object obj, InstanceAdvisor advisor, CachedType type) throws CacheException
{
// TODO workaround for deserialiased objects
- if (advisor == null) {
+ if (advisor == null)
+ {
advisor = new ClassInstanceAdvisor(obj);
((Advised) obj)._setInstanceAdvisor(advisor);
}
@@ -410,27 +444,30 @@
// we will do it recursively.
// Map of sub-objects that are non-primitive
Map subPojoMap = new HashMap();
- boolean hasFieldAnnotation = hasAnnotation(obj.getClass(), ((Advised)obj)._getAdvisor(), type);
+ boolean hasFieldAnnotation = hasAnnotation(obj.getClass(), ((Advised) obj)._getAdvisor(), type);
- for (Iterator i = type.getFields().iterator(); i.hasNext();) {
- Field field = (Field)(((FieldPersistentReference) i.next())).get();
+ for (Iterator i = type.getFields().iterator(); i.hasNext();)
+ {
+ Field field = (Field) (((FieldPersistentReference) i.next())).get();
Object value = null;
- try {
- value=field.get(obj);
+ try
+ {
+ value = field.get(obj);
}
- catch(IllegalAccessException e) {
+ catch (IllegalAccessException e)
+ {
throw new CacheException("field access failed", e);
}
CachedType fieldType = cache_.getCachedType(field.getType());
// check for non-replicatable types
- if(CachedType.isPrimitiveNonReplicatable(field))
+ if (CachedType.isPrimitiveNonReplicatable(field))
{
continue;
}
- if(hasFieldAnnotation)
+ if (hasFieldAnnotation)
{
- if(CachedType.hasTransientAnnotation(field, ((Advised)obj)._getAdvisor()))
+ if (CachedType.hasTransientAnnotation(field, ((Advised) obj)._getAdvisor()))
{
continue;
}
@@ -439,11 +476,13 @@
// we simply treat field that has @Serializable as a primitive type.
if (fieldType.isImmediate() ||
(hasFieldAnnotation &&
- CachedType.hasSerializableAnnotation(field, ((Advised)obj)._getAdvisor())))
+ CachedType.hasSerializableAnnotation(field, ((Advised) obj)._getAdvisor())))
{
// switched using batch update
map.put(field.getName(), value);
- } else {
+ }
+ else
+ {
subPojoMap.put(field, value);
}
}
@@ -454,10 +493,10 @@
internal_.setPojo(aopInstance, obj);
Iterator it = subPojoMap.keySet().iterator();
- while(it.hasNext())
+ while (it.hasNext())
{
- Field field = (Field)it.next();
- Object value= subPojoMap.get(field);
+ Field field = (Field) it.next();
+ Object value = subPojoMap.get(field);
Fqn tmpFqn = new Fqn(fqn, field.getName());
_putObject(tmpFqn, value);
// If it is Collection classes, we replace it with dynamic proxy.
@@ -466,7 +505,8 @@
}
// Need to make sure this is behind put such that obj.toString is done correctly.
- if (log.isDebugEnabled()) {
+ if (log.isDebugEnabled())
+ {
log.debug("_regularPutObject(): inserting with fqn: " + fqn);
}
}
@@ -476,27 +516,30 @@
return CachedType.hasAnnotation(clazz, advisor, type);
}
- private void createNode(Fqn fqn, GlobalTransaction tx) {
+ private void createNode(Fqn fqn, GlobalTransaction tx)
+ {
TreeNode n, child_node;
Object child_name;
- Fqn tmp_fqn=Fqn.ROOT;
+ Fqn tmp_fqn = Fqn.ROOT;
- if(fqn == null) return;
- int treeNodeSize=fqn.size();
- n=cache_.getRoot();
- for(int i=0; i < treeNodeSize; i++) {
- child_name=fqn.get(i);
- tmp_fqn=new Fqn(tmp_fqn, child_name);
- child_node=n.getChild(child_name);
- if(child_node == null) {
- child_node=n.createChild(child_name, tmp_fqn, n);
- if(tx != null) {
- MethodCall undo_op=MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal,
- new Object[]{tx, tmp_fqn, Boolean.FALSE});
+ if (fqn == null) return;
+ int treeNodeSize = fqn.size();
+ n = cache_.getRoot();
+ for (int i = 0; i < treeNodeSize; i++)
+ {
+ child_name = fqn.get(i);
+ tmp_fqn = new Fqn(tmp_fqn, child_name);
+ child_node = n.getChild(child_name);
+ if (child_node == null)
+ {
+ child_node = n.createChild(child_name, tmp_fqn, n);
+ if (tx != null)
+ {
+ MethodCall undo_op = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, tx, tmp_fqn, false);
cache_.addUndoOperation(tx, undo_op);
}
}
- n=child_node;
+ n = child_node;
}
}
@@ -515,27 +558,30 @@
Class clazz = internal_.peekAopClazz(fqn);
if (clazz == null)
{
- if (log.isTraceEnabled()) {
+ if (log.isTraceEnabled())
+ {
log.trace("_removeObject(): clasz is null. fqn: " + fqn + " No need to remove.");
}
return null;
}
- if (log.isDebugEnabled()) {
+ if (log.isDebugEnabled())
+ {
log.debug("_removeObject(): removing object from fqn: " + fqn);
}
Object result = cache_.getObject(fqn);
- if(result == null)
+ if (result == null)
{
// This is not a *Pojo*. Must be regular cache stuffs
- if(cache_.exists(fqn))
+ if (cache_.exists(fqn))
{
// TODO What do we do here. It can still have children pojo though.
- if(!evict)
+ if (!evict)
{
cache_.remove(fqn);
- } else
+ }
+ else
{
cache_._evict(fqn);
}
@@ -544,12 +590,13 @@
}
// can check if we need to do any bulk remove. E.g., if there is no object graph.
- if(getBulkRemove())
+ if (getBulkRemove())
{
- if(bulkRemove(fqn, result))
+ if (bulkRemove(fqn, result))
{
// Remember not to print obj here since it will trigger the CacheInterceptor.
- if(log.isDebugEnabled()) {
+ if (log.isDebugEnabled())
+ {
log.debug("_removeObject(): fqn: " + fqn + "removing exisiting object in bulk.");
}
@@ -564,10 +611,14 @@
}
// Not multi-referenced
- if (Advised.class.isAssignableFrom(clazz)) {
+ if (Advised.class.isAssignableFrom(clazz))
+ {
_regularRemoveObject(fqn, removeCacheInterceptor, result, clazz, evict);
- } else if (collectionHandler_.collectionObjectRemove(fqn, removeCacheInterceptor, evict)) {
- } else
+ }
+ else if (collectionHandler_.collectionObjectRemove(fqn, removeCacheInterceptor, evict))
+ {
+ }
+ else
{ // Just Serializable objects. Do a brute force remove is ok.
serializableHandler_.serializableObjectRemove(fqn);
}
@@ -583,10 +634,12 @@
{
InstanceAdvisor advisor = ((Advised) result)._getInstanceAdvisor();
CachedType type = cache_.getCachedType(clazz);
- for (Iterator i = type.getFields().iterator(); i.hasNext();) {
- Field field = (Field)(((FieldPersistentReference) i.next())).get();
+ for (Iterator i = type.getFields().iterator(); i.hasNext();)
+ {
+ Field field = (Field) (((FieldPersistentReference) i.next())).get();
CachedType fieldType = cache_.getCachedType(field.getType());
- if (!fieldType.isImmediate()) {
+ if (!fieldType.isImmediate())
+ {
_removeObject(new Fqn(fqn, field.getName()), removeCacheInterceptor, evict);
}
}
@@ -595,13 +648,15 @@
cache_.removeData(fqn);
// Determine if we want to keep the interceptor for later use.
- if(removeCacheInterceptor) {
+ if (removeCacheInterceptor)
+ {
CacheInterceptor interceptor = (CacheInterceptor) AopUtil.findCacheInterceptor(advisor);
// Remember to remove the interceptor from in-memory object but make sure it belongs to me first.
if (interceptor != null)
{
- if (log.isDebugEnabled()) {
- log.debug("regularRemoveObject(): removed cache interceptor fqn: " + fqn + " interceptor: "+interceptor);
+ if (log.isDebugEnabled())
+ {
+ log.debug("regularRemoveObject(): removed cache interceptor fqn: " + fqn + " interceptor: " + interceptor);
}
advisor.removeInterceptor(interceptor.getName());
cache_.addUndoInterceptor(advisor, interceptor, ModificationEntry.INTERCEPTOR_REMOVE);
@@ -612,10 +667,13 @@
boolean isAopNode(Fqn fqn)
{
- try {
+ try
+ {
return (internal_.isAopNode(fqn));
- } catch (Exception e) {
- log.warn("isAopNode(): cache get operation generated exception " +e);
+ }
+ catch (Exception e)
+ {
+ log.warn("isAopNode(): cache get operation generated exception " + e);
return false;
}
}
@@ -626,16 +684,16 @@
// Traverse from fqn to do getObject, if it return a pojo we then stop.
Map map = new HashMap();
Object pojo = _getObject(fqn);
- if(pojo != null)
+ if (pojo != null)
{
map.put(fqn, pojo); // we are done!
return map;
}
findChildObjects(fqn, map);
- if(log.isDebugEnabled())
+ if (log.isDebugEnabled())
{
- log.debug("_findObjects(): Fqn: " +fqn + " size of pojos found: " +map.size());
+ log.debug("_findObjects(): Fqn: " + fqn + " size of pojos found: " + map.size());
}
return map;
}
@@ -644,18 +702,19 @@
{
// We need to traverse then
Set set = cache_.getChildrenNames(fqn);
- if(set == null) return; // We stop here.
+ if (set == null) return; // We stop here.
Iterator it = set.iterator();
- while(it.hasNext())
+ while (it.hasNext())
{
- String obj = (String)it.next();
+ String obj = (String) it.next();
Fqn newFqn = new Fqn(fqn, obj);
Object pojo = _getObject(newFqn);
- if(pojo != null)
+ if (pojo != null)
{
map.put(newFqn, pojo);
- } else
+ }
+ else
{
findChildObjects(newFqn, map);
}
More information about the jboss-cvs-commits
mailing list