[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Manik Surtani
manik at jboss.org
Thu Jul 12 13:04:36 EDT 2007
User: msurtani
Date: 07/07/12 13:04:36
Modified: src/org/jboss/cache/interceptors
CacheLoaderInterceptor.java
Log:
JBCACHE-1120
Revision Changes Path
1.89 +18 -5 JBossCache/src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheLoaderInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -b -r1.88 -r1.89
--- CacheLoaderInterceptor.java 12 Jul 2007 16:35:19 -0000 1.88
+++ CacheLoaderInterceptor.java 12 Jul 2007 17:04:36 -0000 1.89
@@ -25,7 +25,7 @@
* Loads nodes that don't exist at the time of the call into memory from the CacheLoader
*
* @author Bela Ban
- * @version $Id: CacheLoaderInterceptor.java,v 1.88 2007/07/12 16:35:19 msurtani Exp $
+ * @version $Id: CacheLoaderInterceptor.java,v 1.89 2007/07/12 17:04:36 msurtani Exp $
*/
public class CacheLoaderInterceptor extends Interceptor implements CacheLoaderInterceptorMBean
{
@@ -69,6 +69,7 @@
TransactionEntry entry = null;
GlobalTransaction gtx;
boolean recursive = false;// do we also load children?
+ boolean bypassLoadingData = false;
if ((gtx = ctx.getGlobalTransaction()) != null)
@@ -115,6 +116,7 @@
acquireLock = true;
break;
case MethodDeclarations.getNodeMethodLocal_id:
+ bypassLoadingData = true;
case MethodDeclarations.getKeysMethodLocal_id:
case MethodDeclarations.getChildrenNamesMethodLocal_id:
case MethodDeclarations.releaseAllLocksMethodLocal_id:
@@ -149,16 +151,16 @@
{
if (fqn2 != null)
{
- loadIfNeeded(ctx, fqn2, key, initNode, acquireLock, m, entry, false, m.getMethodId() == MethodDeclarations.moveMethodLocal_id);
+ loadIfNeeded(ctx, fqn2, key, initNode, acquireLock, m, entry, false, m.getMethodId() == MethodDeclarations.moveMethodLocal_id, bypassLoadingData);
}
- loadIfNeeded(ctx, fqn, key, initNode, acquireLock, m, entry, recursive, m.getMethodId() == MethodDeclarations.moveMethodLocal_id);
+ loadIfNeeded(ctx, fqn, key, initNode, acquireLock, m, entry, recursive, m.getMethodId() == MethodDeclarations.moveMethodLocal_id, bypassLoadingData);
}
return super.invoke(ctx);
}
- private void loadIfNeeded(InvocationContext ctx, Fqn fqn, Object key, boolean initNode, boolean acquireLock, MethodCall m, TransactionEntry entry, boolean recursive, boolean isMove) throws Throwable
+ private void loadIfNeeded(InvocationContext ctx, Fqn fqn, Object key, boolean initNode, boolean acquireLock, MethodCall m, TransactionEntry entry, boolean recursive, boolean isMove, boolean bypassLoadingData) throws Throwable
{
NodeSPI n = cache.peek(fqn, true);
@@ -194,9 +196,20 @@
// if (!initNode && !wasRemovedInTx(fqn, ctx.getGlobalTransaction()))
if (!wasRemovedInTx(fqn, ctx.getGlobalTransaction()))
{
+ if (bypassLoadingData)
+ {
+ if (n == null && loader.exists(fqn))
+ {
+ // just create a dummy node in memory
+ n = createTempNode(fqn, entry);
+ }
+ }
+ else
+ {
n = loadNode(ctx, fqn, n, entry);
}
}
+ }
// The complete list of children aren't known without loading them
if (recursive || m.getMethodId() == MethodDeclarations.getChildrenNamesMethodLocal_id)
More information about the jboss-cvs-commits
mailing list