[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Manik Surtani
manik at jboss.org
Mon Mar 19 15:03:34 EDT 2007
User: msurtani
Date: 07/03/19 15:03:34
Modified: src/org/jboss/cache/interceptors
ReplicationInterceptor.java
OptimisticReplicationInterceptor.java
OptimisticNodeInterceptor.java
BaseRpcInterceptor.java CacheMgmtInterceptor.java
BaseCacheLoaderInterceptor.java
PessimisticLockInterceptor.java
CacheLoaderInterceptor.java
ActivationInterceptor.java EvictionInterceptor.java
CacheStoreInterceptor.java
Log:
JBCACHE-848 - putForExternalRead()
Revision Changes Path
1.43 +12 -11 JBossCache/src/org/jboss/cache/interceptors/ReplicationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ReplicationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/ReplicationInterceptor.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- ReplicationInterceptor.java 7 Feb 2007 22:06:41 -0000 1.42
+++ ReplicationInterceptor.java 19 Mar 2007 19:03:34 -0000 1.43
@@ -13,7 +13,7 @@
* 'side-ways' (see docs/design/Refactoring.txt).
*
* @author Bela Ban
- * @version $Id: ReplicationInterceptor.java,v 1.42 2007/02/07 22:06:41 genman Exp $
+ * @version $Id: ReplicationInterceptor.java,v 1.43 2007/03/19 19:03:34 msurtani Exp $
*/
public class ReplicationInterceptor extends BaseRpcInterceptor
{
@@ -73,6 +73,8 @@
// now pass up the chain
o = super.invoke(m);
break;
+ case MethodDeclarations.putForExternalReadMethodLocal_id:
+ cache.getTransactionTable().get(gtx).setForceAsyncReplication(true);
}
}
}
@@ -102,17 +104,16 @@
configuration.getCacheMode() + ", exclude_self=" + true + ", timeout=" +
configuration.getSyncReplTimeout());
}
- switch (mode)
+ if (mode == Configuration.CacheMode.REPL_ASYNC || m.getMethodId() == MethodDeclarations.putForExternalReadMethodLocal_id)
{
- case REPL_ASYNC:
// 2. Replicate change to all *other* members (exclude self !)
replicateCall(m, false);
- break;
- case REPL_SYNC:
+ }
+ else
+ {
// REVISIT Needs to exclude itself and apply the local change manually.
// This is needed such that transient field is modified properly in-VM.
replicateCall(m, true);
- break;
}
}
1.35 +9 -6 JBossCache/src/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticReplicationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- OptimisticReplicationInterceptor.java 17 Mar 2007 19:11:03 -0000 1.34
+++ OptimisticReplicationInterceptor.java 19 Mar 2007 19:03:34 -0000 1.35
@@ -133,6 +133,9 @@
throw temp2;
}
break;
+ case MethodDeclarations.putForExternalReadMethodLocal_id:
+ cache.getTransactionTable().get(gtx).setForceAsyncReplication(true);
+ // and follow on to default behaviour now ...
default:
//it is something we do not care about
log.debug(" received method " + m + " not handling");
1.58 +1 -0 JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticNodeInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- OptimisticNodeInterceptor.java 17 Mar 2007 19:11:03 -0000 1.57
+++ OptimisticNodeInterceptor.java 19 Mar 2007 19:03:34 -0000 1.58
@@ -152,6 +152,7 @@
cache.getNotifier().notifyNodeModified(fqn, false, CacheListener.ModificationType.PUT_MAP, workspaceNode.getData(), false);
break;
case MethodDeclarations.putKeyValMethodLocal_id:
+ case MethodDeclarations.putForExternalReadMethodLocal_id:
Object key = args[2];
Object value = args[3];
Map addedData = new HashMap();
1.22 +11 -5 JBossCache/src/org/jboss/cache/interceptors/BaseRpcInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BaseRpcInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/BaseRpcInterceptor.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- BaseRpcInterceptor.java 19 Jan 2007 02:04:28 -0000 1.21
+++ BaseRpcInterceptor.java 19 Mar 2007 19:03:34 -0000 1.22
@@ -8,9 +8,11 @@
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
+import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.transaction.TransactionEntry;
import org.jgroups.Address;
-import java.util.Iterator;
+import javax.transaction.Transaction;
import java.util.List;
/**
@@ -41,12 +43,10 @@
*/
protected void checkResponses(List rsps) throws Throwable
{
- Object rsp;
if (rsps != null)
{
- for (Iterator it = rsps.iterator(); it.hasNext();)
+ for (Object rsp : rsps)
{
- rsp = it.next();
if (rsp != null && rsp instanceof Throwable)
{
// lets print a stack trace first.
@@ -67,7 +67,13 @@
{
if (log.isTraceEnabled()) log.trace("Broadcasting call " + call + " to recipient list " + recipients);
-
+ Transaction tx = null;
+ if (cache.getTransactionManager() != null && (tx = cache.getTransactionManager().getTransaction()) != null)
+ {
+ GlobalTransaction gtx = cache.getTransactionTable().get(tx);
+ TransactionEntry te = cache.getTransactionTable().get(gtx);
+ if (te != null && te.isForceAsyncReplication()) sync = false;
+ }
if (!sync && cache.getRPCManager().getReplicationQueue() != null && !usingBuddyReplication)
{
putCallOnAsyncReplicationQueue(call);
1.28 +2 -1 JBossCache/src/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheMgmtInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CacheMgmtInterceptor.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- CacheMgmtInterceptor.java 3 Jan 2007 17:50:31 -0000 1.27
+++ CacheMgmtInterceptor.java 19 Mar 2007 19:03:34 -0000 1.28
@@ -43,7 +43,7 @@
* Captures cache management statistics
*
* @author Jerry Gauthier
- * @version $Id: CacheMgmtInterceptor.java,v 1.27 2007/01/03 17:50:31 msurtani Exp $
+ * @version $Id: CacheMgmtInterceptor.java,v 1.28 2007/03/19 19:03:34 msurtani Exp $
*/
public class CacheMgmtInterceptor extends Interceptor implements CacheMgmtInterceptorMBean, NotificationBroadcaster
{
@@ -136,6 +136,7 @@
m_hits++;
}
break;
+ case MethodDeclarations.putForExternalReadMethodLocal_id:
case MethodDeclarations.putKeyValMethodLocal_id:
t1 = System.currentTimeMillis();
retval = super.invoke(m);
1.9 +4 -7 JBossCache/src/org/jboss/cache/interceptors/BaseCacheLoaderInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BaseCacheLoaderInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/BaseCacheLoaderInterceptor.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- BaseCacheLoaderInterceptor.java 2 Jan 2007 17:15:29 -0000 1.8
+++ BaseCacheLoaderInterceptor.java 19 Mar 2007 19:03:34 -0000 1.9
@@ -10,7 +10,6 @@
import org.jboss.cache.loader.CacheLoader;
import java.util.ConcurrentModificationException;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -71,19 +70,17 @@
protected void releaseLoaderLocks(List locks)
{
- Iterator it = locks.iterator();
- while (it.hasNext())
+ for (Object lock : locks)
{
- releaseLoaderLock(it.next());
+ releaseLoaderLock(lock);
}
}
protected void obtainLoaderLocks(List locks) throws InterruptedException
{
- Iterator it = locks.iterator();
- while (it.hasNext())
+ for (Object lock : locks)
{
- obtainLoaderLock(it.next());
+ obtainLoaderLock(lock);
}
}
}
1.51 +7 -1 JBossCache/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PessimisticLockInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- PessimisticLockInterceptor.java 5 Mar 2007 19:15:56 -0000 1.50
+++ PessimisticLockInterceptor.java 19 Mar 2007 19:03:34 -0000 1.51
@@ -36,7 +36,7 @@
* current method and unlock when the method returns.
*
* @author Bela Ban
- * @version $Id: PessimisticLockInterceptor.java,v 1.50 2007/03/05 19:15:56 msurtani Exp $
+ * @version $Id: PessimisticLockInterceptor.java,v 1.51 2007/03/19 19:03:34 msurtani Exp $
*/
public class PessimisticLockInterceptor extends Interceptor
{
@@ -118,6 +118,12 @@
fqn = (Fqn) args[1];
lock_type = NodeLock.LockType.WRITE;
break;
+ case MethodDeclarations.putForExternalReadMethodLocal_id:
+ createIfNotExists = true;
+ fqn = (Fqn) args[1];
+ lock_type = NodeLock.LockType.WRITE;
+ zeroLockTimeout = true;
+ break;
case MethodDeclarations.removeNodeMethodLocal_id:
isDeleteOperation = true;
fqn = (Fqn) args[1];
1.79 +5 -7 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.78
retrieving revision 1.79
diff -u -b -r1.78 -r1.79
--- CacheLoaderInterceptor.java 27 Feb 2007 21:57:36 -0000 1.78
+++ CacheLoaderInterceptor.java 19 Mar 2007 19:03:34 -0000 1.79
@@ -5,9 +5,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.loader.AsyncCacheLoader;
-import org.jboss.cache.loader.CacheLoader;
-import org.jboss.cache.loader.ChainingCacheLoader;
import org.jboss.cache.lock.NodeLock;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
@@ -28,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.78 2007/02/27 21:57:36 msurtani Exp $
+ * @version $Id: CacheLoaderInterceptor.java,v 1.79 2007/03/19 19:03:34 msurtani Exp $
*/
public class CacheLoaderInterceptor extends BaseCacheLoaderInterceptor implements CacheLoaderInterceptorMBean
{
@@ -88,6 +85,7 @@
fqn = (Fqn) args[1];
initNode = true;
break;
+ case MethodDeclarations.putForExternalReadMethodLocal_id:
case MethodDeclarations.putKeyValMethodLocal_id:
fqn = (Fqn) args[1];
if (useCacheStore)
1.53 +2 -1 JBossCache/src/org/jboss/cache/interceptors/ActivationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ActivationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/ActivationInterceptor.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- ActivationInterceptor.java 12 Mar 2007 18:13:46 -0000 1.52
+++ ActivationInterceptor.java 19 Mar 2007 19:03:34 -0000 1.53
@@ -25,7 +25,7 @@
* their attributes have been initialized and their children have been loaded in memory.
*
* @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
- * @version $Id: ActivationInterceptor.java,v 1.52 2007/03/12 18:13:46 msurtani Exp $
+ * @version $Id: ActivationInterceptor.java,v 1.53 2007/03/19 19:03:34 msurtani Exp $
*/
public class ActivationInterceptor extends CacheLoaderInterceptor implements ActivationInterceptorMBean
{
@@ -112,6 +112,7 @@
// since CacheStoreInterceptor.put() returns the old value
switch (m.getMethodId())
{
+ case MethodDeclarations.putForExternalReadMethodLocal_id:
case MethodDeclarations.putDataMethodLocal_id:
case MethodDeclarations.putDataEraseMethodLocal_id:
case MethodDeclarations.putKeyValMethodLocal_id:
1.14 +8 -7 JBossCache/src/org/jboss/cache/interceptors/EvictionInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EvictionInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/EvictionInterceptor.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- EvictionInterceptor.java 29 Jan 2007 05:10:28 -0000 1.13
+++ EvictionInterceptor.java 19 Mar 2007 19:03:34 -0000 1.14
@@ -27,7 +27,7 @@
* This interceptor is used to handle eviction events.
*
* @author Daniel Huang
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
*/
public class EvictionInterceptor extends Interceptor
{
@@ -60,6 +60,7 @@
handler = new PutKeyEvictionMethodHandler();
evictionMethodHandlers.put(MethodDeclarations.putKeyValMethodLocal_id, handler);
+ evictionMethodHandlers.put(MethodDeclarations.putForExternalReadMethodLocal_id, handler);
handler = new PartialEvictionEvictionMethodHandler();
evictionMethodHandlers.put(MethodDeclarations.evictNodeMethodLocal_id, handler);
1.47 +2 -1 JBossCache/src/org/jboss/cache/interceptors/CacheStoreInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheStoreInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CacheStoreInterceptor.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- CacheStoreInterceptor.java 5 Mar 2007 19:54:03 -0000 1.46
+++ CacheStoreInterceptor.java 19 Mar 2007 19:03:34 -0000 1.47
@@ -27,7 +27,7 @@
* through the CacheLoader, either after each method call (no TXs), or at TX commit.
*
* @author Bela Ban
- * @version $Id: CacheStoreInterceptor.java,v 1.46 2007/03/05 19:54:03 msurtani Exp $
+ * @version $Id: CacheStoreInterceptor.java,v 1.47 2007/03/19 19:03:34 msurtani Exp $
*/
public class CacheStoreInterceptor extends BaseCacheLoaderInterceptor implements CacheStoreInterceptorMBean
{
@@ -223,6 +223,7 @@
m_cacheStores++;
}
break;
+ case MethodDeclarations.putForExternalReadMethodLocal_id:
case MethodDeclarations.putKeyValMethodLocal_id:
fqn = (Fqn) args[1];
key = args[2];
More information about the jboss-cvs-commits
mailing list