[jboss-cvs] JBossCache/src-50/org/jboss/cache/pojo/impl ...
Ben Wang
bwang at jboss.com
Wed Jan 3 03:55:37 EST 2007
User: bwang
Date: 07/01/03 03:55:37
Modified: src-50/org/jboss/cache/pojo/impl InternalHelper.java
CollectionClassHandler.java ObjectGraphHandler.java
PojoCacheImpl.java PojoCacheDelegate.java
Log:
Siwtch RuntimeException to PojoCacheException inside PojoCache.
Revision Changes Path
1.8 +18 -7 JBossCache/src-50/org/jboss/cache/pojo/impl/InternalHelper.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InternalHelper.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/impl/InternalHelper.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- InternalHelper.java 2 Jan 2007 17:15:30 -0000 1.7
+++ InternalHelper.java 3 Jan 2007 08:55:37 -0000 1.8
@@ -15,6 +15,7 @@
import org.jboss.cache.pojo.InternalConstant;
import org.jboss.cache.pojo.PojoInstance;
import org.jboss.cache.pojo.PojoReference;
+import org.jboss.cache.pojo.PojoCacheException;
import org.jboss.cache.pojo.util.ObjectUtil;
import java.util.Map;
@@ -107,7 +108,7 @@
{
PojoInstance pojoInstance = getAopInstance(originalFqn);
if (pojoInstance == null)
- throw new RuntimeException("InternalDelegate.incrementRefCount(): null pojoReference for fqn: " + originalFqn);
+ throw new PojoCacheException("InternalDelegate.incrementRefCount(): null pojoReference for fqn: " + originalFqn);
int count = pojoInstance.incrementRefCount(referencingFqn);
// need to update it.
@@ -137,9 +138,9 @@
else if (cache_.getCacheLoaderManager() != null)
{
// We have cache loader, we can't get it directly from the local get.
- cache_.getInvocationContext().getOptionOverrides().setSuppressLocking(true);
+// cache_.getInvocationContext().getOptionOverrides().setSuppressLocking(true);
Object obj = cache_.get(fqn, key);
- cache_.getInvocationContext().getOptionOverrides().setSuppressLocking(false);
+// cache_.getInvocationContext().getOptionOverrides().setSuppressLocking(false);
return obj;
}
else
@@ -184,12 +185,12 @@
{
PojoInstance pojoInstance = getAopInstance(originalFqn);
if (pojoInstance == null)
- throw new RuntimeException("InternalDelegate.decrementRefCount(): null pojoReference.");
+ throw new PojoCacheException("InternalDelegate.decrementRefCount(): null pojoReference.");
int count = pojoInstance.decrementRefCount(referencingFqn);
if (count < -1) // can't dip below -1
- throw new RuntimeException("InternalDelegate.decrementRefCount(): null pojoReference.");
+ throw new PojoCacheException("InternalDelegate.decrementRefCount(): null pojoReference.");
// need to update it.
put(originalFqn, PojoInstance.KEY, pojoInstance);
@@ -239,7 +240,7 @@
{
PojoInstance pojoInstance = getAopInstance(fqn);
if (pojoInstance == null)
- throw new RuntimeException("InternalDelegate.getInternalFqn(): null pojoReference.");
+ throw new PojoCacheException("InternalDelegate.getInternalFqn(): null pojoReference.");
pojoInstance.removeInternalFqn();
put(fqn, PojoInstance.KEY, pojoInstance);
@@ -355,7 +356,9 @@
if (cache_.getRoot().getChild(fqn).getChildren() != null)
{
// remove everything
- cache_.removeNode(fqn);
+// cache_.removeNode(fqn);
+ cache_.getRoot().getChild(fqn).clearData();
+ removeNodeWithoutInterceptor(fqn);
}
else
{
@@ -368,6 +371,14 @@
}
}
+ private void removeNodeWithoutInterceptor(Fqn fqn)
+ {
+ Option option = cache_.getInvocationContext().getOptionOverrides();
+ option.setBypassInterceptorChain(false);
+ cache_.removeNode(fqn);
+ }
+
+
String createIndirectFqn(String fqn) throws CacheException
{
String indirectFqn = getIndirectFqn(fqn);
1.13 +2 -2 JBossCache/src-50/org/jboss/cache/pojo/impl/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/impl/CollectionClassHandler.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- CollectionClassHandler.java 14 Nov 2006 12:28:07 -0000 1.12
+++ CollectionClassHandler.java 3 Jan 2007 08:55:37 -0000 1.13
@@ -32,7 +32,7 @@
*
* @author Ben Wang
* Date: Aug 4, 2005
- * @version $Id: CollectionClassHandler.java,v 1.12 2006/11/14 12:28:07 bwang Exp $
+ * @version $Id: CollectionClassHandler.java,v 1.13 2007/01/03 08:55:37 bwang Exp $
*/
class CollectionClassHandler
{
@@ -257,7 +257,7 @@
{
if (!(obj instanceof ClassProxy))
{
- throw new RuntimeException("CollectionClassHandler.collectionRemoveObject(): object is not a proxy :" + obj);
+ throw new PojoCacheException("CollectionClassHandler.collectionRemoveObject(): object is not a proxy :" + obj);
}
Interceptor interceptor = CollectionInterceptorUtil.getInterceptor((ClassProxy) obj);
1.9 +4 -4 JBossCache/src-50/org/jboss/cache/pojo/impl/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/impl/ObjectGraphHandler.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- ObjectGraphHandler.java 6 Nov 2006 23:32:17 -0000 1.8
+++ ObjectGraphHandler.java 3 Jan 2007 08:55:37 -0000 1.9
@@ -31,7 +31,7 @@
*
* @author Ben Wang
* Date: Aug 4, 2005
- * @version $Id: ObjectGraphHandler.java,v 1.8 2006/11/06 23:32:17 genman Exp $
+ * @version $Id: ObjectGraphHandler.java,v 1.9 2007/01/03 08:55:37 bwang Exp $
*/
class ObjectGraphHandler
{
@@ -54,7 +54,7 @@
obj = pCache_.getObject(fqn);
if (obj == null)
- throw new RuntimeException("ObjectGraphHandler.get(): null object from internal ref node." +
+ throw new PojoCacheException("ObjectGraphHandler.get(): null object from internal ref node." +
" Internal ref node: " + fqn);
return obj; // No need to set the instance under fqn. It is located in refFqn anyway.
@@ -71,14 +71,14 @@
{
advisor = ((Advised) obj)._getInstanceAdvisor();
if (advisor == null)
- throw new RuntimeException("put(): InstanceAdvisor is null for: " + obj);
+ throw new PojoCacheException("put(): InstanceAdvisor is null for: " + obj);
// Step Check for cross references
interceptor = AopUtil.findCacheInterceptor(advisor);
} else
{
advisor = ((ClassProxy) obj)._getInstanceAdvisor();
if (advisor == null)
- throw new RuntimeException("put(): InstanceAdvisor is null for: " + obj);
+ throw new PojoCacheException("put(): InstanceAdvisor is null for: " + obj);
interceptor = CollectionInterceptorUtil.getInterceptor((ClassProxy) obj);
}
1.29 +2 -2 JBossCache/src-50/org/jboss/cache/pojo/impl/PojoCacheImpl.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PojoCacheImpl.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/impl/PojoCacheImpl.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- PojoCacheImpl.java 2 Jan 2007 18:26:06 -0000 1.28
+++ PojoCacheImpl.java 3 Jan 2007 08:55:37 -0000 1.29
@@ -42,7 +42,7 @@
* Implementation class for PojoCache interface
*
* @author Ben Wang
- * @version $Id: PojoCacheImpl.java,v 1.28 2007/01/02 18:26:06 msurtani Exp $
+ * @version $Id: PojoCacheImpl.java,v 1.29 2007/01/03 08:55:37 bwang Exp $
*/
public class PojoCacheImpl implements PojoCache, Observer
{
@@ -180,7 +180,7 @@
public String getPojoID(Object pojo)
{
- throw new RuntimeException("getPojoID not yet implemented");
+ throw new PojoCacheException("getPojoID not yet implemented");
}
public Object find(String id) throws PojoCacheException
1.19 +6 -4 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.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- PojoCacheDelegate.java 30 Dec 2006 17:50:03 -0000 1.18
+++ PojoCacheDelegate.java 3 Jan 2007 08:55:37 -0000 1.19
@@ -22,6 +22,7 @@
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;
@@ -215,16 +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);
if (base == null)
{
log.debug("The node retrieved is null from fqn: " + f);
return;
}
- Option option = cache_.getInvocationContext().getOptionOverrides();
option.setBypassInterceptorChain(true);
base.addChild(child);
}
@@ -338,7 +340,7 @@
PojoInstance pojoInstance = internal_.getAopInstance(internalFqn);
if (pojoInstance == null)
{
- throw new RuntimeException("PojoCacheDelegate.getObjectInternal(): null PojoInstance for fqn: " +
+ throw new PojoCacheException("PojoCacheDelegate.getObjectInternal(): null PojoInstance for fqn: " +
internalFqn);
}
@@ -378,7 +380,7 @@
{
InstanceAdvisor advisor = ((Advised) obj)._getInstanceAdvisor();
if (advisor == null)
- throw new RuntimeException("_putObject(): InstanceAdvisor is null for: " + obj);
+ throw new PojoCacheException("_putObject(): InstanceAdvisor is null for: " + obj);
// Step Check for cross references
interceptor = AopUtil.findCacheInterceptor(advisor);
@@ -484,7 +486,7 @@
// add interceptor
InstanceAdvisor advisor = ((Advised) obj)._getInstanceAdvisor();
if (advisor == null)
- throw new RuntimeException("pojoGraphMultipleReferenced(): InstanceAdvisor is null for: " + obj);
+ throw new PojoCacheException("pojoGraphMultipleReferenced(): InstanceAdvisor is null for: " + obj);
BaseInterceptor interceptor = (BaseInterceptor) AopUtil.findCacheInterceptor(advisor);
// just in case
More information about the jboss-cvs-commits
mailing list