JBoss Cache SVN: r4509 - in core/branches/1.4.X: src/org/jboss/cache/interceptors and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-09-26 14:41:27 -0400 (Wed, 26 Sep 2007)
New Revision: 4509
Removed:
core/branches/1.4.X/src/org/jboss/cache/NodeCreationResult.java
core/branches/1.4.X/tests/functional/org/jboss/cache/lock/pessimistic/
core/branches/1.4.X/tests/functional/org/jboss/cache/transaction/AsyncRollbackTxLockTest.java
core/branches/1.4.X/tests/functional/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java
Modified:
core/branches/1.4.X/src/org/jboss/cache/DataNode.java
core/branches/1.4.X/src/org/jboss/cache/Node.java
core/branches/1.4.X/src/org/jboss/cache/TransactionTable.java
core/branches/1.4.X/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
Log:
Reversed fixes and tests for JBCACHE-1165, JBCACHE-1166, JBCACHE-1168, JBCACHE-1164, JBCACHE-1183, to release 1.4.1.SP5
Modified: core/branches/1.4.X/src/org/jboss/cache/DataNode.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/DataNode.java 2007-09-26 17:33:33 UTC (rev 4508)
+++ core/branches/1.4.X/src/org/jboss/cache/DataNode.java 2007-09-26 18:41:27 UTC (rev 4509)
@@ -51,14 +51,4 @@
void unmarkForRemoval(boolean deep);
void markForRemoval();
- /**
- * This method hs identical functionality as getOrCreateChild, but returns a NodeCreationResult.
- * If the node was created, NodeCreationResult#isCreated() returns true.
- * @param name name of child to create
- * @param tx transaction under which to create child
- * @param createIfNotExists if false don't attempt to create the node if it doesn't exist
- * @return a NodeCreationResult instance
- */
- NodeCreationResult getOrCreateChildWithCreateInformation(Object name, GlobalTransaction tx, boolean createIfNotExists);
-
}
Modified: core/branches/1.4.X/src/org/jboss/cache/Node.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/Node.java 2007-09-26 17:33:33 UTC (rev 4508)
+++ core/branches/1.4.X/src/org/jboss/cache/Node.java 2007-09-26 18:41:27 UTC (rev 4509)
@@ -318,64 +318,55 @@
return this.data().put(key, value);
}
}
-
- public NodeCreationResult getOrCreateChildWithCreateInformation(Object child_name, GlobalTransaction gtx, boolean createIfNotExists){
- NodeCreationResult result = new NodeCreationResult();
- DataNode child;
- if (child_name == null)
- throw new IllegalArgumentException("null child name");
- child = (DataNode) children().get(child_name);
- if (createIfNotExists && child == null)
- {
- if (log.isTraceEnabled()) log.trace("Children:"+children);
- // construct the new child outside the synchronized block to avoid
- // spending any more time than necessary in the synchronized section
- Fqn child_fqn = new Fqn(this.fqn, child_name);
- DataNode newChild = (DataNode) NodeFactory.getInstance().createNodeOfType(this, child_name, child_fqn, this, null, cache);
- if (newChild == null)
- throw new IllegalStateException();
- synchronized (this)
- {
- // check again to see if the child exists
- // after acquiring exclusive lock
- child = (Node) children().get(child_name);
- if (child == null)
- {
- child = newChild;
- children.put(child_name, child);
- if (gtx != null)
- {
- MethodCall undo_op = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal,
- new Object[]{gtx, child_fqn, Boolean.FALSE});
- cache.addUndoOperation(gtx, undo_op);
- // add the node name to the list maintained for the current tx
- // (needed for abort/rollback of transaction)
- // cache.addNode(gtx, child.getFqn());
- }
- }
- }
-
- // notify if we actually created a new child
- if (newChild == child)
- {
- if (trace)
- {
- log.trace("created child: fqn=" + child_fqn);
- }
- result.setCreated(true);
- cache.notifyNodeCreated(child.getFqn());
- }else{
- result.setCreated(false);
- }
- }
- result.setTreeNode(child);
- return result;
- }
-
public TreeNode getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean createIfNotExists)
{
- return getOrCreateChildWithCreateInformation(child_name, gtx, createIfNotExists).getTreeNode();
+ DataNode child;
+ if (child_name == null)
+ throw new IllegalArgumentException("null child name");
+
+ child = (DataNode) children().get(child_name);
+ if (createIfNotExists && child == null)
+ {
+ // construct the new child outside the synchronized block to avoid
+ // spending any more time than necessary in the synchronized section
+ Fqn child_fqn = new Fqn(this.fqn, child_name);
+ DataNode newChild = (DataNode) NodeFactory.getInstance().createNodeOfType(this, child_name, child_fqn, this, null, cache);
+ if (newChild == null)
+ throw new IllegalStateException();
+ synchronized (this)
+ {
+ // check again to see if the child exists
+ // after acquiring exclusive lock
+ child = (Node) children().get(child_name);
+ if (child == null)
+ {
+ child = newChild;
+ children.put(child_name, child);
+ if (gtx != null)
+ {
+ MethodCall undo_op = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal,
+ new Object[]{gtx, child_fqn, Boolean.FALSE});
+ cache.addUndoOperation(gtx, undo_op);
+ // add the node name to the list maintained for the current tx
+ // (needed for abort/rollback of transaction)
+ // cache.addNode(gtx, child.getFqn());
+ }
+ }
+ }
+
+ // notify if we actually created a new child
+ if (newChild == child)
+ {
+ if (trace)
+ {
+ log.trace("created child: fqn=" + child_fqn);
+ }
+ cache.notifyNodeCreated(child.getFqn());
+ }
+ }
+ return child;
+
}
public TreeNode createChild(Object child_name, Fqn fqn, TreeNode parent)
@@ -516,13 +507,13 @@
if (trace)
{
log.trace(new StringBuffer("acquiring RL: fqn=").append(fqn).append(", caller=").append(caller).
- append(", lock=").append(lock_.toString(DataNode.PRINT_LOCK_DETAILS)).append("lock_hc="+lock_.hashCode()).append(", this._hc=").append(this.hashCode()));
+ append(", lock=").append(lock_.toString(DataNode.PRINT_LOCK_DETAILS)));
}
boolean flag = lock_.acquireReadLock(caller, timeout);
if (trace)
{
log.trace(new StringBuffer("acquired RL: fqn=").append(fqn).append(", caller=").append(caller).
- append(", lock=").append(lock_.toString(DataNode.PRINT_LOCK_DETAILS)).append("lock_hc="+lock_.hashCode()).append(", this._hc=").append(this.hashCode()));
+ append(", lock=").append(lock_.toString(DataNode.PRINT_LOCK_DETAILS)));
}
return flag;
}
@@ -533,13 +524,13 @@
if (trace)
{
log.trace(new StringBuffer("acquiring WL: fqn=").append(fqn).append(", caller=").append(caller).
- append(", lock=").append(lock_.toString(DataNode.PRINT_LOCK_DETAILS)).append("lock_hc="+lock_.hashCode()).append(", this._hc=").append(this.hashCode()));
+ append(", lock=").append(lock_.toString(DataNode.PRINT_LOCK_DETAILS)));
}
boolean flag = lock_.acquireWriteLock(caller, timeout);
if (trace)
{
log.trace(new StringBuffer("acquired WL: fqn=").append(fqn).append(", caller=").append(caller).
- append(", lock=").append(lock_.toString(DataNode.PRINT_LOCK_DETAILS)).append("lock_hc="+lock_.hashCode()).append(", this._hc=").append(this.hashCode()));
+ append(", lock=").append(lock_.toString(DataNode.PRINT_LOCK_DETAILS)));
}
return flag;
}
Deleted: core/branches/1.4.X/src/org/jboss/cache/NodeCreationResult.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/NodeCreationResult.java 2007-09-26 17:33:33 UTC (rev 4508)
+++ core/branches/1.4.X/src/org/jboss/cache/NodeCreationResult.java 2007-09-26 18:41:27 UTC (rev 4509)
@@ -1,19 +0,0 @@
-package org.jboss.cache;
-
-public class NodeCreationResult
-{
- private TreeNode treeNode;
- private boolean created;
- public boolean isCreated() {
- return created;
- }
- public void setCreated(boolean created) {
- this.created = created;
- }
- public TreeNode getTreeNode() {
- return treeNode;
- }
- public void setTreeNode(TreeNode treeNode) {
- this.treeNode = treeNode;
- }
-}
Modified: core/branches/1.4.X/src/org/jboss/cache/TransactionTable.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/TransactionTable.java 2007-09-26 17:33:33 UTC (rev 4508)
+++ core/branches/1.4.X/src/org/jboss/cache/TransactionTable.java 2007-09-26 18:41:27 UTC (rev 4509)
@@ -179,45 +179,39 @@
/**
* Adds a lock to the global transaction.
- * @return true if the lock was added
*/
- public boolean addLock(GlobalTransaction gtx, IdentityLock l) {
+ public void addLock(GlobalTransaction gtx, IdentityLock l) {
TransactionEntry entry=get(gtx);
if(entry == null) {
log.error("transaction entry not found for (gtx=" + gtx + ")");
- return false;
+ return;
}
entry.addLock(l);
- return true;
}
/**
* Adds a collection of locks to the global transaction.
- * @return true if the locks were added
*/
- public boolean addLocks(GlobalTransaction gtx, Collection locks) {
+ public void addLocks(GlobalTransaction gtx, Collection locks) {
TransactionEntry entry=get(gtx);
if(entry == null) {
log.error("transaction entry not found for (gtx=" + gtx + ")");
- return false;
+ return;
}
entry.addLocks(locks);
- return true;
}
/**
* Adds a node that has been removed to the global transaction
- * @return true if the removed node was added to the list of removed nodes
*/
- public boolean addRemovedNode(GlobalTransaction gtx, Fqn fqn)
+ public void addRemovedNode(GlobalTransaction gtx, Fqn fqn)
{
TransactionEntry entry=get(gtx);
if(entry == null) {
log.error("transaction entry not found for (gtx=" + gtx + ")");
- return false;
+ return;
}
entry.addRemovedNode(fqn);
- return true;
}
/**
Modified: core/branches/1.4.X/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2007-09-26 17:33:33 UTC (rev 4508)
+++ core/branches/1.4.X/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2007-09-26 18:41:27 UTC (rev 4509)
@@ -8,14 +8,11 @@
import org.jboss.cache.DataNode;
import org.jboss.cache.Fqn;
-import org.jboss.cache.NodeCreationResult;
import org.jboss.cache.GlobalTransaction;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Node;
import org.jboss.cache.TransactionEntry;
import org.jboss.cache.TransactionTable;
import org.jboss.cache.TreeCache;
-import org.jboss.cache.TreeNode;
import org.jboss.cache.lock.IdentityLock;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.lock.LockingException;
@@ -44,6 +41,7 @@
public class PessimisticLockInterceptor extends Interceptor
{
TransactionTable tx_table = null;
+
boolean writeLockOnChildInsertRemove = true;
/**
@@ -117,9 +115,6 @@
lock_timeout = ((Long) args[5]).longValue();
break;
case MethodDeclarations.removeNodeMethodLocal_id:
- // createIfNotExists is set to true to prevent the endless loop in JBCACHE-1165.
- // See http://jboss.org/index.html?module=bb&op=viewtopic&t=118186 for an explanation of this.
- createIfNotExists = true;
fqn = (Fqn) args[1];
lock_type = DataNode.LOCK_TYPE_WRITE;
recursive = true; // remove node and *all* child nodes
@@ -173,112 +168,25 @@
// If no TX: add each acquired lock to the list of locks for this method (locks)
// If TX: [merge code from TransactionInterceptor]: register with TxManager, on commit/rollback,
// release the locks for the given TX
- /*if (fqn != null)
+ if (fqn != null)
{
- // limit the time spent in the loop attempting to acquire locks.
- long startTime = System.currentTimeMillis();
- boolean finish;
-
- do
+ if (createIfNotExists)
{
- GlobalTransaction gtx = ctx.getGlobalTransaction();
- // first try and lock the node in question.
- DataNode lockedNode = lock(fqn, gtx, lock_type, recursive, zeroLockTimeout ? 0 : lock_timeout, createIfNotExists, storeLockedNode, isRemoveData);
-
- // test whether we need to retry getting the lock.
- finish = !createIfNotExists;
-
- // if we need to create the node, or the locked node was not null, we need to test if this is the *same* node that is in the cache
- // to prevent a race condition between concurrent creation and deletion.
- if (createIfNotExists || lockedNode != null)
+ do
{
- DataNode dataNode = getNodeFromCache(fqn, ctx.getGlobalTransaction());// fetch node from cache
- finish = finish || dataNode != null;
- // compare the two nodes. These *should* be the same object instances. If not, we have a problem - try and re-acquire the lock.
- if (dataNode != lockedNode)
- {
- finish = false;
- if (log.isDebugEnabled()) log.debug("Lock was acquired but node changed (createIfNotExists=" + createIfNotExists + ")");
- releaseLock(lockedNode.getLock(), gtx == null ? (Object) Thread.currentThread() : gtx);
- }
+ lock(fqn, ctx.getGlobalTransaction(), lock_type, recursive, zeroLockTimeout ? 0 : lock_timeout, createIfNotExists, storeLockedNode, isRemoveData);
}
-
- // additional timeout check - if we haven't finished and have taken > lock_timeout milliseconds, throw a TimeoutException.
- // if zeroLockTimeout is specified, there is no time for retries!
- if (!finish && (zeroLockTimeout || System.currentTimeMillis() - startTime > lock_timeout))
- {
- String msg = "PessimicticLockInterceptor can't acquire lock after [" + lock_timeout + "] ms";
- log.error(msg);
- throw new TimeoutException(msg);
- }
-
- } while (!finish); // keep trying until we have the lock, or we time out.
+ while(!cache.exists(fqn)); // keep trying until we have the lock (fixes concurrent remove())
+ // terminates successfully, or with (Timeout)Exception
+ }
+ else
+ lock(fqn, ctx.getGlobalTransaction(), lock_type, recursive, zeroLockTimeout ? 0 : lock_timeout, createIfNotExists, storeLockedNode, isRemoveData);
}
else
{
if (log.isTraceEnabled())
log.trace("bypassed locking as method " + m.getName() + "() doesn't require locking");
- }*/
-
-
- if (fqn != null)
- {
- long startTime = System.currentTimeMillis();//we can;t spend in this loop more than lock_timeout!
- if (createIfNotExists)
- {
- boolean finish = false;
- do
- {
- if (!zeroLockTimeout && (System.currentTimeMillis()-startTime>lock_timeout)){
- String msg = "PessimicticLockInterceptor can't acquire lock after ["+lock_timeout+"] ms.";
- log.error(msg);
- throw new TimeoutException(msg);
- }
- DataNode lockedNode = lock(fqn, ctx.getGlobalTransaction(), lock_type, recursive, zeroLockTimeout ? 0 : lock_timeout, createIfNotExists, storeLockedNode, isRemoveData);
- DataNode dataNode = getNodeFromCache(fqn,ctx.getGlobalTransaction());
- finish = dataNode!=null;
- if (finish && lockedNode!=null){
- if (dataNode!=lockedNode){
- finish = false;
- log.trace("Lock was acquired but node changed (createIfNotExists=true)");
- }
- }
- }
- while(!finish); // keep trying until we have the lock (fixes concurrent remove())
- // terminates successfully, or with (Timeout)Exception
- }
- else{
- boolean finish = false;
- do
- {
- if (!zeroLockTimeout && (System.currentTimeMillis()-startTime>lock_timeout)){
- String msg = "PessimicticLockInterceptor can't acquire lock after ["+lock_timeout+"] ms";
- log.error(msg);
- throw new TimeoutException(msg);
- }
- DataNode lockedNode = lock(fqn, ctx.getGlobalTransaction(), lock_type, recursive, zeroLockTimeout ? 0 : lock_timeout, createIfNotExists, storeLockedNode, isRemoveData);
- if (lockedNode!=null){
- DataNode dataNode = getNodeFromCache(fqn,ctx.getGlobalTransaction());
- if (dataNode!=lockedNode){
- finish = false;
- log.trace("Lock was acquired but node changed (createIfNotExists=false)");
- }else{
- finish=true;
- }
- }else{
- finish = true;
- }
- }
- while(!finish); // keep trying until we have the lock (fixes concurrent remove())
- }
}
- else
- {
- if (log.isTraceEnabled())
- log.trace("bypassed locking as method " + m.getName() + "() doesn't require locking");
- }
-
-
if (m.getMethodId() == MethodDeclarations.lockMethodLocal_id)
return null;
@@ -301,44 +209,9 @@
return o;
}
- /**
- * Return node from cache, include nodes marked as removal only if they are removed by this transaction
- *
- * @param fqn fqn
- * @return DataNode
- */
- private DataNode getNodeFromCache(Fqn fqn, GlobalTransaction gtx)
- {
- DataNode root = cache.getRoot();
- if (fqn == null || fqn.size() == 0) return root;
- TreeNode n = root;
- int fqnSize = fqn.size();
- for (int i = 0; i < fqnSize; i++)
- {
- Object obj = fqn.get(i);
- n = n.getChild(obj);
- if (n == null)
- return null;
- else if (((DataNode) n).isMarkedForRemoval())
- {
- if (gtx != null && !tx_table.get(gtx).getRemovedNodes().contains(n.getFqn()))
- {
- return null;
- }
- }
- }
- return (Node) n;
- }
-
-
private void cleanup(GlobalTransaction gtx)
{
TransactionEntry entry = tx_table.get(gtx);
- if (entry == null)
- {
- if (log.isInfoEnabled()) log.info("Unable to clean up since transaction entry for tx " + gtx + " is null. Perhaps the transaction has timed out?");
- return;
- }
// Let's do it in stack style, LIFO
entry.releaseAllLocksLIFO(gtx);
@@ -358,11 +231,10 @@
* @param gtx
* @param lock_type DataNode.LOCK_TYPE_READ, DataNode.LOCK_TYPE_WRITE or DataNode.LOCK_TYPE_NONE
* @param recursive Lock children recursively
- * @return node on which lock was acquired or null if lock was not acquired
*/
- private DataNode lock(Fqn fqn, GlobalTransaction gtx, int lock_type, boolean recursive,
- long lock_timeout, boolean createIfNotExists, boolean isRemoveNodeOperation, boolean isRemoveDataOperation)
- throws TimeoutException, LockingException, InterruptedException
+ private void lock(Fqn fqn, GlobalTransaction gtx, int lock_type, boolean recursive,
+ long lock_timeout, boolean createIfNotExists, boolean isRemoveNodeOperation, boolean isRemoveDataOperation)
+ throws TimeoutException, LockingException, InterruptedException
{
DataNode n;
DataNode child_node;
@@ -378,11 +250,11 @@
if (fqn == null)
{
log.error("fqn is null - this should not be the case");
- return null;
+ return;
}
if ((treeNodeSize = fqn.size()) == 0)
- return null;
+ return;
if (cache.getIsolationLevelClass() == IsolationLevel.NONE)
lock_type = DataNode.LOCK_TYPE_NONE;
@@ -390,7 +262,6 @@
n = cache.getRoot();
for (int i = -1; i < treeNodeSize; i++)
{
- boolean nodeCreated = false;
if (i == -1)
{
child_name = Fqn.ROOT.getName();
@@ -399,17 +270,14 @@
else
{
child_name = fqn.get(i);
-// child_node = (DataNode) n.getOrCreateChild(child_name, gtx, createIfNotExists);
- NodeCreationResult result = n.getOrCreateChildWithCreateInformation(child_name, gtx, createIfNotExists);
- child_node = (DataNode) result.getTreeNode();
- nodeCreated = result.isCreated();
+ child_node = (DataNode) n.getOrCreateChild(child_name, gtx, createIfNotExists);
}
if (child_node == null)
{
if (log.isTraceEnabled())
log.trace("failed to find or create child " + child_name + " of node " + n.getFqn());
- return null;
+ return;
}
if (lock_type == DataNode.LOCK_TYPE_NONE)
@@ -420,7 +288,7 @@
}
else
{
- if (nodeCreated || writeLockNeeded(lock_type, i, treeNodeSize, isRemoveNodeOperation, createIfNotExists, isRemoveDataOperation, fqn, child_node.getFqn()))
+ if (writeLockNeeded(lock_type, i, treeNodeSize, isRemoveNodeOperation, createIfNotExists, isRemoveDataOperation, fqn, child_node.getFqn()))
{
currentLockType = DataNode.LOCK_TYPE_WRITE;
}
@@ -429,12 +297,14 @@
currentLockType = DataNode.LOCK_TYPE_READ;
}
}
+
// reverse the "remove" if the node has been previously removed in the same tx, if this operation is a put()
if (gtx != null && needToReverseRemove(child_node, tx_table.get(gtx), lock_type, isRemoveNodeOperation, createIfNotExists))
{
reverseRemove(child_node);
}
+
// Try to acquire the lock; recording that we did if successful
acquireNodeLock(child_node, owner, gtx, currentLockType, lock_timeout);
@@ -446,12 +316,7 @@
{
if (gtx != null)
{
- boolean reallyAdded = tx_table.addLocks(gtx, acquired_locks);
- if (!reallyAdded)
- {
- releaseLocks(acquired_locks, owner);
- throw new LockingException("Locks can't be added to current transaction table (transaction timed out?)");
- }
+ cache.getTransactionTable().addLocks(gtx, acquired_locks);
}
else
{
@@ -465,21 +330,13 @@
}
// Add the Fqn to be removed to the transaction entry so we can clean up after ourselves during commit/rollback
- if (isRemoveNodeOperation && gtx != null)
- {
- if (!tx_table.addRemovedNode(gtx, fqn))
- {
- throw new LockingException("Removed node can't be added to current transaction table (transaction timed out?)");
- }
- }
- return n;
+ if (isRemoveNodeOperation && gtx != null) cache.getTransactionTable().get(gtx).addRemovedNode(fqn);
}
-
private boolean needToReverseRemove(DataNode n, TransactionEntry te, int lockTypeRequested, boolean isRemoveOperation, boolean createIfNotExists)
{
return !isRemoveOperation && createIfNotExists && lockTypeRequested == DataNode.LOCK_TYPE_WRITE && n.isMarkedForRemoval()
- && hasBeenRemovedInCurrentTx(te, n.getFqn());
+ && hasBeenRemovedInCurrentTx(te, n.getFqn());
}
private boolean hasBeenRemovedInCurrentTx(TransactionEntry te, Fqn f)
@@ -525,50 +382,17 @@
if (acquired)
{
// Record the lock for release on method return or tx commit/rollback
- recordNodeLock(gtx, node.getLock(), owner);
+ recordNodeLock(gtx, node.getLock());
}
}
- private void releaseLocks(Set acquired_locks, Object owner)
+ private void recordNodeLock(GlobalTransaction gtx, IdentityLock lock)
{
- if (acquired_locks != null && !acquired_locks.isEmpty())
- {
- Iterator iter = acquired_locks.iterator();
- while (iter.hasNext())
- {
- IdentityLock identityLock = (IdentityLock) iter.next();
- releaseLock(identityLock, owner);
- }
- }
- }
-
- private void releaseLock(IdentityLock lock, Object owner)
- {
- if (lock != null)
- {
- if (log.isDebugEnabled())
- {
- log.debug("Releasing lock [" + lock + "]");
- }
- lock.release(owner);
- }
- }
-
- private void recordNodeLock(GlobalTransaction gtx, IdentityLock lock, Object owner) throws LockingException
- {
if (gtx != null)
{
- // test that the gtx is associated with a valid tx.
- Transaction tx = tx_table.getLocalTransaction(gtx);
- if (!isValid(tx)) throw new LockingException("Locks can't be added to current transaction (transaction timed out?)");
// add the lock to the list of locks maintained for this transaction
// (needed for release of locks on commit or rollback)
- boolean reallyAdded = tx_table.addLock(gtx, lock);
- if (!reallyAdded)
- {
- releaseLock(lock, owner);
- throw new LockingException("Locks can't be added to current transaction (transaction timed out?)");
- }
+ cache.getTransactionTable().addLock(gtx, lock);
}
else
{
@@ -578,6 +402,7 @@
}
}
+
private List getLocks(Thread currentThread)
{
// This sort of looks like a get/put race condition, but
@@ -632,7 +457,7 @@
TransactionEntry entry = tx_table.get(gtx);
if (entry == null)
{
- if (log.isInfoEnabled()) log.info("entry for transaction " + gtx + " not found (transaction timed out?)");
+ log.error("entry for transaction " + gtx + " not found (maybe already committed)");
return;
}
@@ -666,7 +491,7 @@
if (entry == null)
{
- if (log.isInfoEnabled()) log.info("entry for transaction " + tx + " not found (transaction timed out?)");
+ log.error("entry for transaction " + tx + " not found (transaction has possibly already been rolled back)");
return;
}
@@ -683,4 +508,3 @@
}
}
-
Deleted: core/branches/1.4.X/tests/functional/org/jboss/cache/transaction/AsyncRollbackTxLockTest.java
===================================================================
--- core/branches/1.4.X/tests/functional/org/jboss/cache/transaction/AsyncRollbackTxLockTest.java 2007-09-26 17:33:33 UTC (rev 4508)
+++ core/branches/1.4.X/tests/functional/org/jboss/cache/transaction/AsyncRollbackTxLockTest.java 2007-09-26 18:41:27 UTC (rev 4509)
@@ -1,109 +0,0 @@
-package org.jboss.cache.transaction;
-
-import junit.framework.TestCase;
-import org.jboss.cache.TreeCache;
-import org.jboss.cache.lock.LockingException;
-
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-/**
- * Test behaviour of async rollback of a tx that times out and subsequent operations on that transaction.
- * <p/>
- * NOTE: To run this test, add the following lines:
- * <p/>
- * <tt>
- * <p/>
- * <p/>
- * if ("Thread-0".equals(Thread.currentThread().getName())) Thread.sleep(1500);
- * <p/>
- * </tt>
- * <p/>
- * to the first line of PessimistickLockInterceptor#recordNodeLock()
- *
- * @author <a href="mailto:jhalat@infovide.pl">Jacek Halat</a>
- */
-public class AsyncRollbackTxLockTest extends TestCase
-{
- private TreeCache cache;
- private TransactionManager tm;
-
- protected void setUp() throws Exception
- {
- cache = new TreeCache();
-
- cache.setTransactionManagerLookupClass("org.jboss.cache.transaction.AsyncRollbackTransactionManagerLookup");
- cache.startService();
- tm = cache.getTransactionManager();
- tm.setTransactionTimeout(2);
- }
-
- protected void tearDown()
- {
- try
- {
- if (tm != null && tm.getTransaction() != null)
- {
- try
- {
- tm.rollback();
- }
- catch (SystemException e)
- {
- // do nothing
- }
- }
- }
- catch (SystemException e)
- {
- // do nothing
- }
- if (cache != null) cache.stopService();
- cache = null;
- tm = null;
- }
-
-
- public void testTxTimeoutAndRemovePutAfter() throws Exception
- {
- Thread.currentThread().setName("Thread-0");
- System.out.println("Main Thread:" + Thread.currentThread());
- assertEquals(0, cache.getNumberOfLocksHeld());
- tm.setTransactionTimeout(1);//short transaction timeout
- cache.put("/a/b/c/d", "k", "v");
- tm.begin();
- Transaction transaction = tm.getTransaction();
- transaction.registerSynchronization(new Synchronization()
- {
-
- public void afterCompletion(int arg0)
- {
- System.out.println("Synchronization Thread:" + Thread.currentThread());
- }
-
- public void beforeCompletion()
- {
- }
-
- });
- assertNotNull(tm.getTransaction());
- Thread.sleep(500);//transaction should be rolledback in another thread
- try
- {
- cache.put("/a", "k", "v");
- }
- catch (LockingException expected)
- {
- // this is normal; the tx would have timed out and obtaining locks for this tx should fail.
- }
-
- tm.rollback();
- assertNull(tm.getTransaction());
- assertEquals(0, cache.getNumberOfLocksHeld());
- cache.put("/a", "k", "v");
- }
-
-}
-
Deleted: core/branches/1.4.X/tests/functional/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java
===================================================================
--- core/branches/1.4.X/tests/functional/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java 2007-09-26 17:33:33 UTC (rev 4508)
+++ core/branches/1.4.X/tests/functional/org/jboss/cache/transaction/SimultaneousRollbackAndPutTest.java 2007-09-26 18:41:27 UTC (rev 4509)
@@ -1,105 +0,0 @@
-package org.jboss.cache.transaction;
-
-import junit.framework.TestCase;
-import org.jboss.cache.DummyTransactionManagerLookup;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.TreeCache;
-
-import javax.transaction.RollbackException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * To test JBCACHE-923
- *
- * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
- */
-public class SimultaneousRollbackAndPutTest extends TestCase
-{
- private TreeCache cache;
- private TransactionManager tm;
- private Fqn A = Fqn.fromString("/a"), B = Fqn.fromString("/b");
-
- protected void setUp() throws Exception
- {
- cache = new TreeCache();
- cache.setTransactionManagerLookupClass(AsyncRollbackTransactionManagerLookup.class.getName());
- cache.start();
- tm = cache.getTransactionManager();
- cache.put(A, "k", "v");
- }
-
- protected void tearDown()
- {
- cache.stop();
- }
-
- public void testStaleLocks() throws Exception
- {
- // repeat this test several times.
- for (int i = 0; i < 1000; i++)
- {
- System.out.println("In loop " + i);
- doTest();
- cache.remove(B);
- cache.removeData(A);
- cache.put(A, "k", "v");
- }
-
- }
-
-
- private void doTest() throws Exception
- {
- // scenario:
- // Thread starts tx in cache. E.g., create and put into B
- tm.begin();
- final Transaction t = tm.getTransaction();
- final List exceptions = new ArrayList();
-
- cache.put(B, "k", "v");
-
- // now the container should attempt to rollback the tx in a separate thread.
- Thread rollbackThread = new Thread()
- {
- public void run()
- {
- try
- {
- t.rollback();
- }
- catch (Exception e)
- {
- exceptions.add(e);
- }
- }
- };
- rollbackThread.start();
-
- try
- {
- // now try and put stuff in the main thread again
- cache.put(A, "k2", "v2");
- tm.commit();
- }
- catch (Exception expected)
- {
- // this is expected.
- }
-
- // make sure the rollback thread has completed
- rollbackThread.join();
-
- int nL = cache.getNumberOfLocksHeld();
- if (nL > 0)
- {
- System.out.println(cache.printLockInfo());
- fail("Should be no stale locks around!");
- }
- //assertEquals("No stale locks should be around", 0, cache.getNumberOfLocksHeld());
-
- if (exceptions.size() > 0) throw ((Exception) exceptions.get(0));
- }
-}
17 years, 3 months
JBoss Cache SVN: r4508 - core/trunk.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-09-26 13:33:33 -0400 (Wed, 26 Sep 2007)
New Revision: 4508
Added:
core/trunk/README-i18n.txt
Log:
Added i18n instructions
Added: core/trunk/README-i18n.txt
===================================================================
--- core/trunk/README-i18n.txt (rev 0)
+++ core/trunk/README-i18n.txt 2007-09-26 17:33:33 UTC (rev 4508)
@@ -0,0 +1,28 @@
+Internationalising documentation
+--------------------------------
+
+Documentation for JBoss Cache is written using docbook XML. There is a lot of reference material on docbook XML if
+you are unfamiliar with it, but JBoss Cache's usage of docbook is pretty basic and most of it can be picked up by looking
+through the existing documentation sources, which are in src/main/docbook.
+
+For each document, the 'en' version is treated as the reference source for all translations.
+
+Starting a new translation
+--------------------------
+
+** NB: This section needs updating since moving to subversion.
+
+Each time a new translation is started, the docs directory should be updated and tagged as I18N_<2-letter iso lang code>_<2-letter iso country code> (optional)
+such as I18N_IT or I18N_PT_BR (note all in upper case)
+
+Updating translations
+---------------------
+
+Each time a new release is made, translations should be updated by:
+
+1) Doing a diff of the 'en' docs, comparing the latest against the translation tag (e.g., I18N_IT)
+2) Updating the translation (e.g., the 'it' docs)
+3) Moving the translation tag on the 'en' files (e.g., I18N_IT) to the current snapshot.
+
+- Manik Surtani
+
17 years, 3 months
JBoss Cache SVN: r4507 - in core/trunk/src: main/java/org/jboss/cache/interceptors and 3 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2007-09-26 06:15:08 -0400 (Wed, 26 Sep 2007)
New Revision: 4507
Added:
core/trunk/src/main/java/org/jboss/cache/MetadataNodeWrapper.java
core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
Modified:
core/trunk/src/main/java/org/jboss/cache/AbstractNode.java
core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
core/trunk/src/main/java/org/jboss/cache/Node.java
core/trunk/src/main/java/org/jboss/cache/NodeSPI.java
core/trunk/src/main/java/org/jboss/cache/Region.java
core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
core/trunk/src/main/java/org/jboss/cache/RegionManager.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java
core/trunk/src/main/resources/META-INF/local-lru-eviction-service.xml
Log:
JBCACHE-1154
Modified: core/trunk/src/main/java/org/jboss/cache/AbstractNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/AbstractNode.java 2007-09-25 20:55:20 UTC (rev 4506)
+++ core/trunk/src/main/java/org/jboss/cache/AbstractNode.java 2007-09-26 10:15:08 UTC (rev 4507)
@@ -15,7 +15,13 @@
protected boolean deleted;
protected Map<Object, Node<K, V>> children;
protected Fqn fqn;
+ protected boolean resident;
+ /**
+ * Under this key the {@link #resident} attribute will be keept within the data map.
+ */
+ protected static final String INTERNAL_IS_RESIDENT = "_jbosscache.internal.resident";
+
public boolean isDeleted()
{
return deleted;
@@ -41,6 +47,26 @@
}
}
+ public void setResident(boolean resident)
+ {
+ if (!resident)
+ {
+ remove((K)INTERNAL_IS_RESIDENT);
+ } else
+ {
+ put((K)INTERNAL_IS_RESIDENT, (V)"True");
+ }
+ }
+
+
+ public boolean isResident()
+ {
+ //hack - see setResident internals for details
+ return "True".equals(get((K)INTERNAL_IS_RESIDENT));
+ }
+
+
+
public boolean equals(Object another)
{
if (another instanceof AbstractNode)
@@ -51,6 +77,7 @@
return false;
}
+
public int hashCode()
{
return fqn.hashCode();
Modified: core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-09-25 20:55:20 UTC (rev 4506)
+++ core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-09-26 10:15:08 UTC (rev 4507)
@@ -281,7 +281,7 @@
*/
public NodeSPI<K, V> getRoot()
{
- return root;
+ return MetadataNodeWrapper.wrapNodeData(root);
}
/**
@@ -4438,12 +4438,17 @@
public void evict(Fqn<?> fqn, boolean recursive)
{
+ //this method should be called by eviction thread only, so no transaction - expected (sec param is false)
+ Node<K, V> node = peek(fqn, false);
+ if (node != null && node.isResident())
+ {
+ return;
+ }
if (recursive)
{
- Node<K, V> n = get(fqn);
- if (n != null)
+ if (node != null)
{
- evictChildren((NodeSPI<K, V>) n);
+ evictChildren((NodeSPI<K, V>) node);
}
}
else
Added: core/trunk/src/main/java/org/jboss/cache/MetadataNodeWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/MetadataNodeWrapper.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/MetadataNodeWrapper.java 2007-09-26 10:15:08 UTC (rev 4507)
@@ -0,0 +1,420 @@
+package org.jboss.cache;
+
+import org.jboss.cache.Node;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.lock.NodeLock;
+import org.jboss.cache.transaction.GlobalTransaction;
+
+import java.util.*;
+
+/**
+ * Metadata information from class <tt>Node</tt> (metadata = all configuration information except attribute map,
+ * e.g. Node.isResident) is internally also held in the internal attribute map. The role of this class is not the
+ * expose those internal map information to the end user - so it wraps such a node and expose it to the the user
+ * removing wrapped info.
+ *
+ * @author <a href="mailto:mircea.markus@jboss.com">Mircea Markus</a>
+ * @since 2.1.0
+ */
+public class MetadataNodeWrapper implements NodeSPI
+{
+
+ public static final String JBOSSCACHE_INTERNAL_RESIDENT = "_jbosscache.internal.resident";
+
+ private Node wrappedNode;
+
+ public MetadataNodeWrapper(Node wrappedNode)
+ {
+ this.wrappedNode = wrappedNode;
+ }
+
+ public NodeSPI getParent()
+ {
+ return wrapNodeData(wrappedNode);
+ }
+
+ public Set getChildren()
+ {
+ Iterator it = wrappedNode.getChildren().iterator();
+ Set result = new HashSet();
+ while (it.hasNext())
+ {
+ result.add(wrapNodeData((Node) it.next()));
+ }
+ return Collections.unmodifiableSet(result);
+ }
+
+ public Set getChildrenNames()
+ {
+ return wrappedNode.getChildrenNames();
+ }
+
+ public Map getData()
+ {
+ Map realData = wrappedNode.getData();
+ if (!realData.containsKey(JBOSSCACHE_INTERNAL_RESIDENT))
+ {
+ return realData;
+ } else
+ {
+ Map clearedData = new HashMap(realData);
+ clearedData.remove(JBOSSCACHE_INTERNAL_RESIDENT);
+ return Collections.unmodifiableMap(clearedData);
+ }
+ }
+
+ public Set getKeys()
+ {
+ Set realSet = wrappedNode.getKeys();
+ if (!realSet.contains(JBOSSCACHE_INTERNAL_RESIDENT))
+ {
+ return realSet;
+ } else
+ {
+ Set clearedData = new HashSet(realSet);
+ clearedData.remove(JBOSSCACHE_INTERNAL_RESIDENT);
+ return Collections.unmodifiableSet(clearedData);
+ }
+ }
+
+ public Fqn getFqn()
+ {
+ return wrappedNode.getFqn();
+ }
+
+ public Node addChild(Fqn f)
+ {
+ return wrapNodeData(wrappedNode.addChild(f));
+ }
+
+ public boolean removeChild(Fqn f)
+ {
+ return wrappedNode.removeChild(f);
+ }
+
+ public boolean removeChild(Object childName)
+ {
+ return wrappedNode.removeChild(childName);
+ }
+
+ public Node getChild(Fqn f)
+ {
+ return wrapNodeData(wrappedNode.getChild(f));
+ }
+
+ public Node getChild(Object name)
+ {
+ return wrapNodeData(wrappedNode.getChild(name));
+ }
+
+ public Object put(Object key, Object value)
+ {
+ return wrappedNode.put(key, value);
+ }
+
+ public Object putIfAbsent(Object key, Object value)
+ {
+ return wrappedNode.putIfAbsent(key, value);
+ }
+
+ public Object replace(Object key, Object value)
+ {
+ return wrappedNode.replace(key, value);
+ }
+
+ public boolean replace(Object key, Object oldValue, Object newValue)
+ {
+ return wrappedNode.replace(key, oldValue, newValue);
+ }
+
+ public void putAll(Map map)
+ {
+ wrappedNode.putAll(map);
+ }
+
+ public void replaceAll(Map map)
+ {
+ wrappedNode.replaceAll(map);
+ }
+
+ public Object get(Object key)
+ {
+ return wrappedNode.get(key);
+ }
+
+ public Object remove(Object key)
+ {
+ if (JBOSSCACHE_INTERNAL_RESIDENT.equals(key))
+ {
+ throw new IllegalArgumentException("The '" + JBOSSCACHE_INTERNAL_RESIDENT + "' is an reserved key, please " +
+ "refrain using it!");
+ }
+ return wrappedNode.remove(key);
+ }
+
+ public void clearData()
+ {
+ if (wrappedNode.get(JBOSSCACHE_INTERNAL_RESIDENT) == null)
+ {
+ wrappedNode.clearData();
+ } else
+ {
+ Iterator it = wrappedNode.getKeys().iterator();
+ while (it.hasNext())
+ {
+ Object key = it.next();
+ if (!JBOSSCACHE_INTERNAL_RESIDENT.equals(key))
+ {
+ wrappedNode.remove(key);
+ }
+ }
+ }
+ }
+
+ public int dataSize()
+ {
+ if (wrappedNode.getKeys().contains(JBOSSCACHE_INTERNAL_RESIDENT))
+ {
+ return wrappedNode.dataSize() - 1;
+ }
+ return wrappedNode.dataSize();
+ }
+
+ public boolean hasChild(Fqn f)
+ {
+ return wrappedNode.hasChild(f);
+ }
+
+ public boolean hasChild(Object o)
+ {
+ return wrappedNode.hasChild(o);
+ }
+
+ public boolean isValid()
+ {
+ return wrappedNode.isValid();
+ }
+
+ public boolean isResident()
+ {
+ return wrappedNode.isResident();
+ }
+
+ public void setResident(boolean resident)
+ {
+ wrappedNode.setResident(resident);
+ }
+
+ public static MetadataNodeWrapper wrapNodeData(Node node)
+ {
+ if (node == null)
+ {
+ return null;
+ }
+ if (node instanceof MetadataNodeWrapper)
+ {
+ return (MetadataNodeWrapper) node;
+ } else
+ {
+ return new MetadataNodeWrapper(node);
+ }
+ }
+
+
+ public boolean isChildrenLoaded()
+ {
+ return ((NodeSPI) wrappedNode).isChildrenLoaded();
+ }
+
+ public void setChildrenLoaded(boolean loaded)
+ {
+ ((NodeSPI) wrappedNode).setChildrenLoaded(loaded);
+ }
+
+ public boolean isDataLoaded()
+ {
+ return ((NodeSPI) wrappedNode).isDataLoaded();
+ }
+
+ public void setDataLoaded(boolean dataLoaded)
+ {
+ ((NodeSPI) wrappedNode).setDataLoaded(dataLoaded);
+ }
+
+ public Map getChildrenMapDirect()
+ {
+ return ((NodeSPI) wrappedNode).getChildrenMapDirect();
+ }
+
+ public void setChildrenMapDirect(Map children)
+ {
+ ((NodeSPI) wrappedNode).setChildrenMapDirect(children);
+ }
+
+ public NodeSPI getOrCreateChild(Object name, GlobalTransaction tx)
+ {
+ return ((NodeSPI) wrappedNode).getOrCreateChild(name, tx);
+ }
+
+ public NodeLock getLock()
+ {
+ return ((NodeSPI) wrappedNode).getLock();
+ }
+
+ public void setFqn(Fqn f)
+ {
+ ((NodeSPI) wrappedNode).setFqn(f);
+ }
+
+ public boolean isDeleted()
+ {
+ return ((NodeSPI) wrappedNode).isDeleted();
+ }
+
+ public void markAsDeleted(boolean marker)
+ {
+ ((NodeSPI) wrappedNode).markAsDeleted(marker);
+ }
+
+ public void markAsDeleted(boolean marker, boolean recursive)
+ {
+ ((NodeSPI) wrappedNode).markAsDeleted(marker, recursive);
+ }
+
+ public void addChild(Object nodeName, Node nodeToAdd)
+ {
+ ((NodeSPI) wrappedNode).addChild(nodeName, nodeToAdd);
+ }
+
+ public void printDetails(StringBuffer sb, int indent)
+ {
+ ((NodeSPI) wrappedNode).printDetails(sb, indent);
+ }
+
+ public void print(StringBuffer sb, int indent)
+ {
+ ((NodeSPI) wrappedNode).print(sb, indent);
+ }
+
+ public void setVersion(DataVersion version)
+ {
+ ((NodeSPI) wrappedNode).setVersion(version);
+ }
+
+ public DataVersion getVersion()
+ {
+ return ((NodeSPI) wrappedNode).getVersion();
+ }
+
+ public Set getChildrenDirect()
+ {
+ return ((NodeSPI) wrappedNode).getChildrenDirect();
+ }
+
+ public void removeChildrenDirect()
+ {
+ ((NodeSPI) wrappedNode).removeChildrenDirect();
+ }
+
+ public Set getChildrenDirect(boolean includeMarkedAsDeleted)
+ {
+ return ((NodeSPI) wrappedNode).getChildrenDirect(includeMarkedAsDeleted);
+ }
+
+ public NodeSPI getChildDirect(Object childName)
+ {
+ return ((NodeSPI) wrappedNode).getChildDirect(childName);
+ }
+
+ public NodeSPI addChildDirect(Fqn childName)
+ {
+ return ((NodeSPI) wrappedNode).addChildDirect(childName);
+ }
+
+ public void addChildDirect(NodeSPI child)
+ {
+ ((NodeSPI) wrappedNode).addChildDirect(child);
+ }
+
+ public NodeSPI getChildDirect(Fqn childName)
+ {
+ return ((NodeSPI) wrappedNode).getChildDirect(childName);
+ }
+
+ public boolean removeChildDirect(Fqn fqn)
+ {
+ return ((NodeSPI) wrappedNode).removeChildDirect(fqn);
+ }
+
+ public boolean removeChildDirect(Object childName)
+ {
+ return ((NodeSPI) wrappedNode).removeChildDirect(childName);
+ }
+
+ public Object removeDirect(Object key)
+ {
+ return ((NodeSPI) wrappedNode).removeDirect(key);
+ }
+
+ public Object putDirect(Object key, Object value)
+ {
+ return ((NodeSPI) wrappedNode).putDirect(key, value);
+ }
+
+ public void putAllDirect(Map data)
+ {
+ ((NodeSPI) wrappedNode).putAllDirect(data);
+ }
+
+ public Map getDataDirect()
+ {
+ return ((NodeSPI) wrappedNode).getDataDirect();
+ }
+
+ public Object getDirect(Object key)
+ {
+ return ((NodeSPI) wrappedNode).getDirect(key);
+ }
+
+ public void clearDataDirect()
+ {
+ ((NodeSPI) wrappedNode).clearDataDirect();
+ }
+
+ public Set getKeysDirect()
+ {
+ return ((NodeSPI) wrappedNode).getKeysDirect();
+ }
+
+ public Set getChildrenNamesDirect()
+ {
+ return ((NodeSPI) wrappedNode).getChildrenNamesDirect();
+ }
+
+ public CacheSPI getCache()
+ {
+ return ((NodeSPI) wrappedNode).getCache();
+ }
+
+ public boolean hasChildrenDirect()
+ {
+ return ((NodeSPI) wrappedNode).hasChildrenDirect();
+ }
+
+ public boolean isResidentDirect()
+ {
+ return ((NodeSPI) wrappedNode).isResidentDirect();
+ }
+
+
+ public boolean isLockForChildInsertRemove()
+ {
+ return wrappedNode.isLockForChildInsertRemove();
+ }
+
+ public void setLockForChildInsertRemove(boolean lockForChildInsertRemove)
+ {
+ wrappedNode.setLockForChildInsertRemove(lockForChildInsertRemove);
+ }
+}
Modified: core/trunk/src/main/java/org/jboss/cache/Node.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Node.java 2007-09-25 20:55:20 UTC (rev 4506)
+++ core/trunk/src/main/java/org/jboss/cache/Node.java 2007-09-26 10:15:08 UTC (rev 4507)
@@ -277,7 +277,21 @@
*/
boolean isValid();
+ /**
+ * Nodes marked resident would be ignored by the eviction algorithms. E.g. if the algorithm is
+ * "keep LRU 10 nodes" - the resident nodes won't be counted within those 10 nodes,
+ * and also won't be evicted when the threshold is reached.
+ * N.B. calling this method won't have any effect on node's eviction, e.g. we won't consider this node as being
+ * 'used' in a LRU scenario
+ */
+ boolean isResident();
+
/**
+ * @see #isResident()
+ */
+ void setResident(boolean resident);
+
+ /**
* Tests whether this node is configured to be exclusively locked when inserting or removing children.
* <p />
* The default
@@ -297,5 +311,4 @@
* @since 2.1.0
*/
void setLockForChildInsertRemove(boolean lockForChildInsertRemove);
-
}
Modified: core/trunk/src/main/java/org/jboss/cache/NodeSPI.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/NodeSPI.java 2007-09-25 20:55:20 UTC (rev 4506)
+++ core/trunk/src/main/java/org/jboss/cache/NodeSPI.java 2007-09-26 10:15:08 UTC (rev 4507)
@@ -437,4 +437,10 @@
* @return true if the node has one or more child nodes; false otherwise.
*/
boolean hasChildrenDirect();
+
+
+ /**
+ * Same as {@link #isResident()} but it bypasses the interceptors chain.
+ */
+ boolean isResidentDirect();
}
Modified: core/trunk/src/main/java/org/jboss/cache/Region.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Region.java 2007-09-25 20:55:20 UTC (rev 4506)
+++ core/trunk/src/main/java/org/jboss/cache/Region.java 2007-09-26 10:15:08 UTC (rev 4507)
@@ -168,6 +168,8 @@
*
* @param fqn Fqn of the node.
* @see #unmarkNodeCurrentlyInUse(Fqn)
+ * @deprecated you are now able to specify Node.setResident which has (almost -> i.e. you cannot specify a timeout)
+ * the same behavior. That metod also replicates the change clusterwise
*/
void markNodeCurrentlyInUse(Fqn fqn, long timeout);
@@ -176,6 +178,8 @@
*
* @param fqn Fqn of the node.
* @see #markNodeCurrentlyInUse(Fqn,long)
+ * @deprecated you are now able to specify Node.isResident which has (almost) the same behavior. That metod also
+ * replicates the change clusterwise
*/
void unmarkNodeCurrentlyInUse(Fqn fqn);
Modified: core/trunk/src/main/java/org/jboss/cache/RegionImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionImpl.java 2007-09-25 20:55:20 UTC (rev 4506)
+++ core/trunk/src/main/java/org/jboss/cache/RegionImpl.java 2007-09-26 10:15:08 UTC (rev 4507)
@@ -149,7 +149,10 @@
" You will need to reduce the wakeUpIntervalSeconds parameter.");
}
- nodeEventQueue.put(event);
+ if (!regionManager.isNodeResident(event.getFqn()))
+ {
+ nodeEventQueue.put(event);
+ }
}
catch (InterruptedException e)
{
Modified: core/trunk/src/main/java/org/jboss/cache/RegionManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RegionManager.java 2007-09-25 20:55:20 UTC (rev 4506)
+++ core/trunk/src/main/java/org/jboss/cache/RegionManager.java 2007-09-26 10:15:08 UTC (rev 4507)
@@ -813,4 +813,19 @@
return this.cache;
}
+ /**
+ * Will check to see if the given node is resident or not.
+ * N.B. This method MUST not raise any eviction events (i.e. do not call any intercepted methods on the cache, but
+ * rather use direct calls). Otherwise an endless loop of events being generated/consumed will take place, as this
+ * is called in the context of consuming events.
+ */
+ public boolean isNodeResident(Fqn fqn)
+ {
+ if (cache == null)
+ {
+ return false;
+ }
+ NodeSPI theNode = cache.getRoot().getChildDirect(fqn);
+ return theNode == null ? false : theNode.isResidentDirect();
+ }
}
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2007-09-25 20:55:20 UTC (rev 4506)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2007-09-26 10:15:08 UTC (rev 4507)
@@ -681,6 +681,11 @@
return children != null && children.size() != 0;
}
+ public boolean isResidentDirect()
+ {
+ return getDataDirect().containsKey(AbstractNode.INTERNAL_IS_RESIDENT);
+ }
+
public Set<NodeSPI<K, V>> getChildrenDirect(boolean includeMarkedForRemoval)
{
if (includeMarkedForRemoval)
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2007-09-25 20:55:20 UTC (rev 4506)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2007-09-26 10:15:08 UTC (rev 4507)
@@ -9,11 +9,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Region;
-import org.jboss.cache.RegionManager;
+import org.jboss.cache.*;
import org.jboss.cache.eviction.EvictedEventNode;
import org.jboss.cache.eviction.NodeEventType;
import org.jboss.cache.marshall.MethodCall;
@@ -98,6 +94,8 @@
// is thrown, this interceptor is terminated. there is no need for explicit rollback logic.
this.updateNode(m, ret);
+
+
if (log.isTraceEnabled())
{
log.trace("Finished invoking EvictionInterceptor");
@@ -200,6 +198,10 @@
Object args[] = mc.getArgs();
Fqn fqn = (Fqn) args[0];
Object key = args[1];
+ /*see hack comment inside PutKeyEvictionMethodHandler.extractEvictedEventNode */
+ if (MetadataNodeWrapper.JBOSSCACHE_INTERNAL_RESIDENT.equals(key)) {
+ return null;
+ }
if (fqn != null && key != null
&& !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.VISIT_NODE_EVENT))
{
@@ -328,11 +330,21 @@
protected class PutKeyEvictionMethodHandler implements EvictionMethodHandler
{
+
public EvictedEventNode extractEvictedEventNode(MethodCall mc, Object retVal)
{
Object[] args = mc.getArgs();
Fqn fqn = (Fqn) args[1];
Object key = args[2];
+ //hack - for seting an node as resident we won't create a an eviction event.
+ //this is an implementation restriction, as this method(i.e. isEvited) is intensively called internally
+ //by the eviction code, which would result in events being produced -> that when consumed would produce
+ // other events (due to call to Node.isResident). The isResidentDirect call cannot be used here
+ //the resident information is stored in the node attributes map directly
+ if (MetadataNodeWrapper.JBOSSCACHE_INTERNAL_RESIDENT.equals(key))
+ {
+ return null;
+ }
if (fqn != null && key != null
&& !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.ADD_ELEMENT_EVENT))
{
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java 2007-09-25 20:55:20 UTC (rev 4506)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java 2007-09-26 10:15:08 UTC (rev 4507)
@@ -92,4 +92,16 @@
return ret.toString();
}
+
+
+ public Object invoke(Object object) throws Throwable
+ {
+ return super.invoke(object); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+
+ public Object invoke(Object object, Object[] objects) throws Throwable
+ {
+ return super.invoke(object, objects); //To change body of overridden methods use File | Settings | File Templates.
+ }
}
Modified: core/trunk/src/main/resources/META-INF/local-lru-eviction-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/local-lru-eviction-service.xml 2007-09-25 20:55:20 UTC (rev 4506)
+++ core/trunk/src/main/resources/META-INF/local-lru-eviction-service.xml 2007-09-26 10:15:08 UTC (rev 4507)
@@ -106,6 +106,11 @@
<attribute name="timeToLiveSeconds">8</attribute>
<attribute name="maxAgeSeconds">10</attribute>
</region>
+ <region name="/residentNodesTest">
+ <attribute name="maxNodes">3</attribute>
+ <attribute name="timeToLiveSeconds">800000</attribute>
+ <attribute name="maxAgeSeconds">100000</attribute>
+ </region>
</config>
</attribute>
</mbean>
Added: core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java 2007-09-26 10:15:08 UTC (rev 4507)
@@ -0,0 +1,219 @@
+package org.jboss.cache.api;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.AfterMethod;
+import static org.testng.Assert.*;
+import static org.testng.Assert.assertNotNull;
+import org.jboss.cache.*;
+import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.loader.DummyInMemoryCacheLoader;
+import org.jboss.cache.loader.DummyCacheLoader;
+import org.jboss.cache.lock.IsolationLevel;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Tester class for Node.isResident functionality.
+ *
+ * @author <a href="mailto:mircea.markus@jboss.com">Mircea Markus</a>
+ * @since 2.1.0
+ */
+@Test(groups = {"functional"})
+public class ResidentNodesTest
+{
+
+ private CacheImpl<Object, Object> cache;
+
+ private final String TEST_NODES_ROOT = "residentNodesTest";
+
+ @BeforeMethod(alwaysRun = true)
+ public void setUp()
+ {
+ cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache("META-INF/local-lru-eviction-service.xml", false);
+ cache.getConfiguration().getEvictionConfig().setWakeupIntervalSeconds(1);
+ cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ CacheLoaderConfig.IndividualCacheLoaderConfig indCLConfig = new CacheLoaderConfig.IndividualCacheLoaderConfig();
+ indCLConfig.setClassName(DummyInMemoryCacheLoader.class.getName());
+ List<CacheLoaderConfig.IndividualCacheLoaderConfig> indCLConfigs = new ArrayList<CacheLoaderConfig.IndividualCacheLoaderConfig>();
+ indCLConfigs.add(indCLConfig);
+ CacheLoaderConfig cacheLoaderConfig = new CacheLoaderConfig();
+ cacheLoaderConfig.setIndividualCacheLoaderConfigs(indCLConfigs);
+ cache.getConfiguration().setCacheLoaderConfig(cacheLoaderConfig);
+ cache.start();
+ }
+
+ @AfterMethod(alwaysRun = true)
+ public void tearDown() throws Exception
+ {
+ cache.stop();
+ }
+
+ /**
+ * Mark some nodes as resident and show that they won't get evicted,
+ * even if normally scenario they would
+ */
+ public void testHappyFlow() throws InterruptedException
+ {
+ cache.put(getSubFqn("/a"), "k_a", "v_a");
+ cache.get(getSubFqn("/a")).setResident(true);
+ cache.put(getSubFqn("/b"), "k_b", "v_b");
+ cache.get(getSubFqn("/b")).setResident(true);
+ cache.put(getSubFqn("/c"), "k_c", "v_c");
+ cache.put(getSubFqn("/d"), "k_d", "v_d");
+ cache.put(getSubFqn("/e"), "k_e", "v_e");
+ cache.put(getSubFqn("/f"), "k_f", "v_f");
+ cache.put(getSubFqn("/g"), "k_g", "v_g");
+ cache.put(getSubFqn("/h"), "k_h", "v_h");
+ cache.put(getSubFqn("/i"), "k_i", "v_i");
+
+ Thread.sleep(3000);//so that eviction is activated
+
+ assertTrue(cache.exists(getSubFqn("/a")));
+ assertTrue(cache.exists(getSubFqn("/b")));
+ assertFalse(cache.exists(getSubFqn("/c")));
+ assertFalse(cache.exists(getSubFqn("/d")));
+ assertFalse(cache.exists(getSubFqn("/e")));
+ assertFalse(cache.exists(getSubFqn("/f")));
+
+ //only last three used are not evicted
+ assertTrue(cache.exists(getSubFqn("/g")));
+ assertTrue(cache.exists(getSubFqn("/h")));
+ assertTrue(cache.exists(getSubFqn("/i")));
+
+ }
+
+ /**
+ * The 'resident' attribute of the node is kept within node's attribute map.
+ * This information won't be visible to the ouside clients if they are not using the
+ * resident attribute. This would ensure a 100% backward comatibility. New clients would need to be aware of this
+ * extra attribute, though.
+ */
+ public void testInternalStateNotVisibleOutside()
+ {
+ cache.put(getSubFqn("/a"), "k_a", "v_a");
+ cache.get(getSubFqn("/a")).setResident(true);
+ assertEquals(cache.getRoot().getChild(getSubFqn("/a")).getData().keySet().size(), 1);
+ assertEquals(cache.getRoot().getChild(getSubFqn("/a")).getKeys().size(), 1);
+ assertTrue(cache.getRoot().getChild(getSubFqn("/a")).isResident());
+
+ cache.get(getSubFqn("/a")).setResident(false);
+ assertFalse(cache.getRoot().getChild(getSubFqn("/a")).isResident());
+ assertEquals(cache.getRoot().getChild(TEST_NODES_ROOT).getChild("a").getData().keySet().size(), 1);
+ assertEquals(cache.getRoot().getChild(TEST_NODES_ROOT).getChild("a").getKeys().size(), 1);
+
+ cache.remove(getSubFqn("/a"), "k_a");
+ assertEquals(cache.get(getSubFqn("/a")).getData().keySet().size(), 0);
+ assertFalse(cache.getRoot().getChild(TEST_NODES_ROOT).getChild("a").isResident());
+
+ cache.get(getSubFqn("/a")).setResident(true);
+ assertEquals(cache.getRoot().getChild(TEST_NODES_ROOT).getChild("a").getData().keySet().size(), 0);
+ assertEquals(cache.getRoot().getChild(TEST_NODES_ROOT).getChild("a").getKeys().size(), 0);
+ assertTrue(cache.getRoot().getChild(TEST_NODES_ROOT).getChild("a").isResident());
+ }
+
+ /**
+ * When replication is on, we want to make sure that the operation will subscribe to the global
+ * replication strategy.
+ */
+ public void testNodeResidencyInformationIsReplicated()
+ {
+ Cache first = DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC));
+ Cache second = DefaultCacheFactory.getInstance().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC));
+ Cache[] caches = {first, second};
+ TestingUtil.blockUntilViewsReceived(caches, 5000);
+
+ System.out.println("Caches started!");
+
+ Fqn fqn = Fqn.fromString("/a/b");
+ first.put(fqn, "key", "value");
+ assertNotNull(second.get(fqn, "key"));
+
+ first.getRoot().getChild(fqn).setResident(true);
+ assertTrue(second.getRoot().getChild(fqn).isResident());
+
+ second.getRoot().getChild(fqn).setResident(false);
+ assertFalse(first.getRoot().getChild(fqn).isResident());
+
+ for (Cache c : caches)
+ {
+ c.stop();
+ }
+ }
+
+ /**
+ * If a node is marked as resident, and a get is made on that given node then an VISITED event would normally be
+ * added to the eviction queue. In a LRU scenario, this will cause another node to be evicted given that the size of
+ * the eviction queue is bounded. This test makes sure that this scenario will not hapen.
+ */
+ public void testNoEvictionEventsForResidentNodes() throws InterruptedException
+ {
+ cache.put(getSubFqn("/a"), "k_a", "v_a");
+ cache.put(getSubFqn("/b"), "k_b", "v_b");
+
+ //cache node reference here as getting a node will trigger an read event
+ cache.get(getSubFqn("/a")).setResident(true);
+ cache.get(getSubFqn("/b")).setResident(true);
+
+ cache.put(getSubFqn("/c"), "k_c", "v_c");
+ cache.put(getSubFqn("/d"), "k_d", "v_d");
+ cache.put(getSubFqn("/e"), "k_e", "v_e");
+ cache.put(getSubFqn("/f"), "k_f", "v_f");
+ cache.put(getSubFqn("/g"), "k_g", "v_g");
+ cache.put(getSubFqn("/h"), "k_h", "v_h");
+
+ //at this point the oldest nodes are /a and /b so. There are eviction events in the queue corresponding
+ // to those nodes
+ cache.get(getSubFqn("/a"));
+ cache.get(getSubFqn("/b"));
+
+ Thread.sleep(3000);//so that eviction is activated
+
+ //a and b should exist as those were marked resident. Also they shouldn't be caunted as nodes in the eviction
+ // queue
+ assertTrue(cache.exists(getSubFqn("/a")));
+ assertTrue(cache.exists(getSubFqn("/b")));
+
+ // c, d and e were the first accessed, they should be evicted
+ assertFalse(cache.exists(getSubFqn("/c")));
+ assertFalse(cache.exists(getSubFqn("/d")));
+ assertFalse(cache.exists(getSubFqn("/e")));
+
+ //all of them should be there - even if we re-retrieved a and b at a prev step (cache.get(getSubFqn("/a"))) this
+ //call shouldn't create an eviction event.
+ assertTrue(cache.exists(getSubFqn("/f")));
+ assertTrue(cache.exists(getSubFqn("/g")));
+ assertTrue(cache.exists(getSubFqn("/h")));
+ }
+
+ /**
+ * Underlying metadata information is held as Strings. As Node is parametrized class with keys and values, and there
+ * is an explicit downcast to String in code, this is just a check to make sure no cast exceptions are being thrown.
+ * Note: this is rather a paranoia check as type info is lost during type erasure and underlying map supports
+ * objects - superclass of Strings
+ */
+ public void testNoStringCache()
+ {
+ CacheFactory<Integer, Float> cacheFactory = DefaultCacheFactory.getInstance();
+ Cache<Integer, Float> cache = cacheFactory.createCache("META-INF/local-lru-eviction-service.xml", true);
+ cache.put(getSubFqn("/a"), 1, 5.3f);
+ cache.put(getSubFqn("/b"), 1, 2.3f);
+ cache.put(getSubFqn("/c"), 1, 7.3f);
+ cache.getRoot().getChild(getSubFqn("/a")).setResident(true);
+ cache.getRoot().getChild(getSubFqn("/b")).setResident(false);
+ cache.getRoot().getChild(getSubFqn("/c")).setResident(true);
+ assertTrue(cache.getRoot().getChild(getSubFqn("/a")).isResident());
+ assertFalse(cache.getRoot().getChild(getSubFqn("/b")).isResident());
+ assertTrue(cache.getRoot().getChild(getSubFqn("/c")).isResident());
+ cache.stop();
+ }
+
+ private Fqn getSubFqn(String str)
+ {
+ return Fqn.fromString("/" + TEST_NODES_ROOT + str);
+ }
+}
17 years, 3 months
JBoss Cache SVN: r4506 - in core/trunk/src/main/java/org/jboss/cache: util and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2007-09-25 16:55:20 -0400 (Tue, 25 Sep 2007)
New Revision: 4506
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
core/trunk/src/main/java/org/jboss/cache/util/ThreadGate.java
Log:
Fix JBCACHE-1173 - ThreadGate does not implement timeouts properly
Modified: core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-09-25 16:07:25 UTC (rev 4505)
+++ core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-09-25 20:55:20 UTC (rev 4506)
@@ -2104,7 +2104,8 @@
if (channel.flushSupported())
{
- flushBlockGate.await(configuration.getStateRetrievalTimeout());
+ if (! flushBlockGate.await(configuration.getStateRetrievalTimeout()))
+ throw new TimeoutException("State retrieval timed out waiting for flush unblock.");
}
rsps = rspFilter == null
? disp.callRemoteMethods(validMembers, method_call, modeToUse, timeout, buddyManager != null && buddyManager.isEnabled())
Modified: core/trunk/src/main/java/org/jboss/cache/util/ThreadGate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/ThreadGate.java 2007-09-25 16:07:25 UTC (rev 4505)
+++ core/trunk/src/main/java/org/jboss/cache/util/ThreadGate.java 2007-09-25 20:55:20 UTC (rev 4506)
@@ -1,46 +1,119 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.cache.util;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
+
/**
- * Copyright (c) 2005 Brian Goetz and Tim Peierls
- * Released under the Creative Commons Attribution License
- * (http://creativecommons.org/licenses/by/2.5)
- * Official home: http://www.jcip.net
- *
- * ThreadGate <p/> Recloseable gate using wait and notifyAll
- *
- * @author Brian Goetz and Tim Peierls
+ * A reclosable gate with timeout support.
+ *
+ * @author Jason T. Greene
*/
+public class ThreadGate
+{
+ private final ReentrantLock lock = new ReentrantLock();
+ private final Condition condition = lock.newCondition();
-public class ThreadGate {
- // CONDITION-PREDICATE: opened-since(n) (isOpen || generation>n)
- private boolean isOpen;
+ private boolean open;
+ private int sequence;
- private int generation;
+ /**
+ * Open the gate.
+ */
+ public void open()
+ {
+ lock.lock();
+ try
+ {
+ open = true;
+ sequence++;
+ condition.signalAll();
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
- public synchronized void close()
- {
- isOpen = false;
- }
+ /**
+ * Close the gate.
+ */
+ public void close()
+ {
+ lock.lock();
+ try
+ {
+ open = false;
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
- public synchronized void open()
- {
- ++generation;
- isOpen = true;
- notifyAll();
- }
+ /**
+ * Waits for the gate to open.
+ *
+ * @throws InterruptedException if this thread is interrupted
+ */
+ public void await() throws InterruptedException
+ {
+ lock.lock();
+ try
+ {
+ int snapshot = sequence;
+ while (!open && snapshot == sequence)
+ condition.await();
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
- // BLOCKS-UNTIL: opened-since(generation on entry)
- public synchronized void await() throws InterruptedException
- {
- int arrivalGeneration = generation;
- while(!isOpen && arrivalGeneration == generation)
- wait();
- }
-
- // BLOCKS-UNTIL: opened-since(generation on entry)
- public synchronized void await(long timeout) throws InterruptedException
- {
- int arrivalGeneration = generation;
- while(!isOpen && arrivalGeneration == generation)
- wait(timeout);
- }
+ /**
+ * Waits for the gate to open or the specified time to elapse.
+ *
+ * @param time the maximum time in milliseconds to wait.
+ * @return false if gate timeout occurred
+ * @throws InterruptedException if this thread is interrupted
+ */
+ public boolean await(long time) throws InterruptedException
+ {
+ lock.lock();
+ try
+ {
+ int snapshot = sequence;
+ boolean success = true;
+ while (!open && snapshot == sequence && success)
+ success = condition.await(time, TimeUnit.MILLISECONDS);
+
+ return success;
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
}
\ No newline at end of file
17 years, 3 months
JBoss Cache SVN: r4505 - in core/trunk/src: test/java/org/jboss/cache/transaction and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-09-25 12:07:25 -0400 (Tue, 25 Sep 2007)
New Revision: 4505
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
Log:
JBCACHE-407 - Write locks not acquired on implicit node creation
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2007-09-25 13:57:00 UTC (rev 4504)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2007-09-25 16:07:25 UTC (rev 4505)
@@ -225,8 +225,8 @@
private long getLockAcquisitionTimeout(InvocationContext ctx)
{
long timeout = lock_acquisition_timeout;
- if (ctx.getOptionOverrides() != null
- && ctx.getOptionOverrides().getLockAcquisitionTimeout() >= 0)
+ if (ctx.getOptionOverrides() != null
+ && ctx.getOptionOverrides().getLockAcquisitionTimeout() >= 0)
{
timeout = ctx.getOptionOverrides().getLockAcquisitionTimeout();
}
@@ -240,7 +240,7 @@
// node should have a WL.
long timeout = getLockAcquisitionTimeout(ctx);
-
+
// this call will ensure the node gets a WL and it's current parent gets RL.
if (log.isTraceEnabled()) log.trace("Attempting to get WL on node to be moved [" + node + "]");
lock(ctx, node, NodeLock.LockType.WRITE, true, false, timeout, true, false, false);
@@ -298,9 +298,11 @@
child_node = n.getChildDirect(child_name);
}
+ boolean created = false;
if (child_node == null && createIfNotExists)
{
child_node = n.addChildDirect(new Fqn(child_name));
+ created = true;
}
if (child_node == null)
@@ -320,7 +322,7 @@
}
else
{
- if (writeLockNeeded(ctx, lock_type, i, treeNodeSize, isEvictionOperation, isDeleteOperation, createIfNotExists, isRemoveDataOperation, fqn, child_node))
+ if (created || writeLockNeeded(ctx, lock_type, i, treeNodeSize, isEvictionOperation, isDeleteOperation, createIfNotExists, isRemoveDataOperation, fqn, child_node))
{
lockTypeRequired = NodeLock.LockType.WRITE;
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java 2007-09-25 13:57:00 UTC (rev 4504)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java 2007-09-25 16:07:25 UTC (rev 4505)
@@ -6,19 +6,7 @@
*/
package org.jboss.cache.transaction;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import javax.transaction.NotSupportedException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-
import junit.framework.AssertionFailedError;
-
import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheImpl;
import org.jboss.cache.DefaultCacheFactory;
@@ -26,17 +14,24 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.lock.TimeoutException;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
/**
* Tests READ_COMMITED isolation level.
*
* @author <a href="mailto:ovidiu@jboss.org">Ovidiu Feodorov</a>
* @version $Id$
*/
-@Test(groups = { "functional", "transaction" })
+@Test(groups = {"functional", "transaction"})
public class IsolationLevelReadCommittedNodeCreationRollbackTest
{
@@ -60,7 +55,7 @@
readerError = null;
CacheFactory<String, String> instance = DefaultCacheFactory.getInstance();
- cache = (CacheImpl<String, String>)instance.createCache(false);
+ cache = (CacheImpl<String, String>) instance.createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setIsolationLevel(IsolationLevel.READ_COMMITTED);
cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
@@ -88,7 +83,8 @@
// start a first thread and a transaction
- Thread firstThread = new Thread(new Runnable() {
+ Thread firstThread = new Thread(new Runnable()
+ {
public void run()
{
try
@@ -138,7 +134,8 @@
// start a second thread; no transaction is necessary here
- Thread secondThread = new Thread(new Runnable() {
+ Thread secondThread = new Thread(new Runnable()
+ {
public void run()
{
try
@@ -168,7 +165,7 @@
secondCanRead.await();
// I should still see the value I put
- assertEquals("Known issue JBCACHE-407 -- write lock not acquired on " + "creation of an empty node", VALUE, cache.get(a2, KEY));
+ assertEquals("write lock not acquired on " + "creation of an empty node", VALUE, cache.get(a2, KEY));
}
catch (AssertionFailedError e)
{
17 years, 3 months
JBoss Cache SVN: r4504 - core/trunk/src/main/java/org/jboss/cache/config.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-09-25 09:57:00 -0400 (Tue, 25 Sep 2007)
New Revision: 4504
Modified:
core/trunk/src/main/java/org/jboss/cache/config/Option.java
Log:
Javadoc typo
Modified: core/trunk/src/main/java/org/jboss/cache/config/Option.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/Option.java 2007-09-25 13:41:09 UTC (rev 4503)
+++ core/trunk/src/main/java/org/jboss/cache/config/Option.java 2007-09-25 13:57:00 UTC (rev 4504)
@@ -200,10 +200,10 @@
* even if the cache is configured in an asynchronous mode. Has no
* effect if the call is occuring within a transactional context.
*
- * @param forceAsynchronous <code>true</code> if replication/invalidation
- * should be done synchronously; <code>false</code>
- * if the default mode configured for the cache
- * should be used.
+ * @param forceSynchronous <code>true</code> if replication/invalidation
+ * should be done synchronously; <code>false</code>
+ * if the default mode configured for the cache
+ * should be used.
*/
public void setForceSynchronous(boolean forceSynchronous)
{
17 years, 3 months
JBoss Cache SVN: r4503 - in core/trunk/src/main/java/org/jboss/cache: config and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-09-25 09:41:09 -0400 (Tue, 25 Sep 2007)
New Revision: 4503
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
core/trunk/src/main/java/org/jboss/cache/config/Option.java
core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
Log:
JBCACHE-549 - Allow overriding of GroupRequest mode and sync repl timeout via Options
Modified: core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-09-25 13:05:59 UTC (rev 4502)
+++ core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-09-25 13:41:09 UTC (rev 4503)
@@ -1136,7 +1136,8 @@
// Lock the parent, create and add the child
try
{
- parent.getLock().acquire(owner, configuration.getSyncReplTimeout(), NodeLock.LockType.WRITE);
+ Option o = getInvocationContext().getOptionOverrides();
+ parent.getLock().acquire(owner, o.getSyncReplTimeout() < 0 ? configuration.getSyncReplTimeout() : o.getSyncReplTimeout(), NodeLock.LockType.WRITE);
}
catch (InterruptedException e)
{
@@ -2053,6 +2054,11 @@
public List callRemoteMethods(List<Address> mbrs, MethodCall method_call, int mode, boolean exclude_self, long timeout, RspFilter rspFilter)
throws Exception
{
+ int modeToUse = mode;
+ int preferredMode;
+ if ((preferredMode = getInvocationContext().getOptionOverrides().getGroupRequestMode()) > -1)
+ modeToUse = preferredMode;
+
RspList rsps = null;
Rsp rsp;
List retval;
@@ -2101,8 +2107,8 @@
flushBlockGate.await(configuration.getStateRetrievalTimeout());
}
rsps = rspFilter == null
- ? disp.callRemoteMethods(validMembers, method_call, mode, timeout, buddyManager != null && buddyManager.isEnabled())
- : disp.callRemoteMethods(validMembers, method_call, mode, timeout, buddyManager != null && buddyManager.isEnabled(), false, rspFilter);
+ ? disp.callRemoteMethods(validMembers, method_call, modeToUse, timeout, buddyManager != null && buddyManager.isEnabled())
+ : disp.callRemoteMethods(validMembers, method_call, modeToUse, timeout, buddyManager != null && buddyManager.isEnabled(), false, rspFilter);
// a null response is 99% likely to be due to a marshalling problem - we throw a NSE, this needs to be changed when
// JGroups supports http://jira.jboss.com/jira/browse/JGRP-193
Modified: core/trunk/src/main/java/org/jboss/cache/config/Option.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/Option.java 2007-09-25 13:05:59 UTC (rev 4502)
+++ core/trunk/src/main/java/org/jboss/cache/config/Option.java 2007-09-25 13:41:09 UTC (rev 4503)
@@ -25,10 +25,13 @@
private boolean forceWriteLock;
private boolean skipCacheStatusCheck;
-
+
private boolean forceAsynchronous;
private boolean forceSynchronous;
-
+
+ private long syncReplTimeout = -1;
+ private int groupRequestMode = -1;
+
private int lockAcquisitionTimeout = -1;
/**
@@ -153,9 +156,9 @@
* Gets whether replication or invalidation should be done asynchronously,
* even if the cache is configured in a synchronous mode. Has no
* effect if the call is occuring within a transactional context.
- *
+ *
* @return <code>true</code> if replication/invalidation should be done
- * asynchronously; <code>false</code> if the default mode
+ * asynchronously; <code>false</code> if the default mode
* configured for the cache should be used.
*/
public boolean isForceAsynchronous()
@@ -167,10 +170,10 @@
* Sets whether replication or invalidation should be done asynchronously,
* even if the cache is configured in a synchronous mode. Has no
* effect if the call is occuring within a transactional context.
- *
- * @param forceAsynchronous <code>true</code> if replication/invalidation
+ *
+ * @param forceAsynchronous <code>true</code> if replication/invalidation
* should be done asynchronously; <code>false</code>
- * if the default mode configured for the cache
+ * if the default mode configured for the cache
* should be used.
*/
public void setForceAsynchronous(boolean forceAsynchronous)
@@ -182,9 +185,9 @@
* Gets whether replication or invalidation should be done synchronously,
* even if the cache is configured in an asynchronous mode. Has no
* effect if the call is occuring within a transactional context.
- *
+ *
* @return <code>true</code> if replication/invalidation should be done
- * synchronously; <code>false</code> if the default mode
+ * synchronously; <code>false</code> if the default mode
* configured for the cache should be used.
*/
public boolean isForceSynchronous()
@@ -196,10 +199,10 @@
* Sets whether replication or invalidation should be done synchronously,
* even if the cache is configured in an asynchronous mode. Has no
* effect if the call is occuring within a transactional context.
- *
- * @param forceAsynchronous <code>true</code> if replication/invalidation
+ *
+ * @param forceAsynchronous <code>true</code> if replication/invalidation
* should be done synchronously; <code>false</code>
- * if the default mode configured for the cache
+ * if the default mode configured for the cache
* should be used.
*/
public void setForceSynchronous(boolean forceSynchronous)
@@ -209,7 +212,7 @@
/**
* Gets any lock acquisition timeout configured for the call.
- *
+ *
* @return the time in ms that lock acquisition attempts should block
* before failing with a TimeoutException. A value < 0 indicates
* that the cache's default timeout should be used.
@@ -221,9 +224,9 @@
/**
* Sets any lock acquisition timeout configured for the call.
- *
- * @param lockAcquisitionTimeout the time in ms that lock acquisition
- * attempts should block before failing with a
+ *
+ * @param lockAcquisitionTimeout the time in ms that lock acquisition
+ * attempts should block before failing with a
* TimeoutException. A value < 0 indicates
* that the cache's default timeout should be used.
*/
@@ -346,4 +349,50 @@
{
return skipCacheStatusCheck;
}
+
+ /**
+ * @return the value of the sync replication timeout (used when cache mode is either {@link org.jboss.cache.config.Configuration.CacheMode#REPL_SYNC}
+ * or {@link org.jboss.cache.config.Configuration.CacheMode#INVALIDATION_SYNC}) to be used for this specific call, or -1 (default) if the
+ * default value in {@link Configuration#getSyncReplTimeout()} is to be used instead.
+ * @since 2.1.0
+ */
+ public long getSyncReplTimeout()
+ {
+ return syncReplTimeout;
+ }
+
+ /**
+ * Used to override the value in {@link Configuration#getSyncReplTimeout()} (used when cache mode is either {@link org.jboss.cache.config.Configuration.CacheMode#REPL_SYNC}
+ * or {@link org.jboss.cache.config.Configuration.CacheMode#INVALIDATION_SYNC}) for this specific invocation. Defaults to -1,
+ * which means use the default in the configuration.
+ *
+ * @param syncReplTimeout new timeout value for this invocation.
+ * @since 2.1.0
+ */
+ public void setSyncReplTimeout(long syncReplTimeout)
+ {
+ this.syncReplTimeout = syncReplTimeout;
+ }
+
+ /**
+ * @return overridden JGroups {@link org.jgroups.blocks.GroupRequest} mode to use, or -1 if the {@link org.jboss.cache.RPCManager}'s
+ * own logic is to be used to select a group request mode (this is the default).
+ * @since 2.1.0
+ */
+ public int getGroupRequestMode()
+ {
+ return groupRequestMode;
+ }
+
+ /**
+ * By default, the {@link org.jboss.cache.RPCManager} has inbuilt logic when it comes to selecting a group request mode.
+ * This can be overridden by setting the group request mode here, using this method, for a specific invocation.
+ *
+ * @param groupRequestMode a group request mode, found in the {@link org.jgroups.blocks.GroupRequest} class.
+ * @since 2.1.0
+ */
+ public void setGroupRequestMode(int groupRequestMode)
+ {
+ this.groupRequestMode = groupRequestMode;
+ }
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2007-09-25 13:05:59 UTC (rev 4502)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2007-09-25 13:41:09 UTC (rev 4503)
@@ -6,8 +6,8 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyManager;
+import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Option;
-import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
@@ -64,12 +64,12 @@
}
}
- protected void replicateCall(MethodCall call, boolean sync) throws Throwable
+ protected void replicateCall(MethodCall call, boolean sync, Option o) throws Throwable
{
- replicateCall(null, call, sync);
+ replicateCall(null, call, sync, o);
}
- protected void replicateCall(List<Address> recipients, MethodCall call, boolean sync) throws Throwable
+ protected void replicateCall(List<Address> recipients, MethodCall call, boolean sync, Option o) throws Throwable
{
if (log.isTraceEnabled()) log.trace("Broadcasting call " + call + " to recipient list " + recipients);
@@ -100,12 +100,15 @@
log.trace("Setting call recipients to " + callRecipients + " since the original list of recipients passed in is null.");
}
+ long syncReplTimeout = o.getSyncReplTimeout();
+ if (syncReplTimeout < 0) syncReplTimeout = configuration.getSyncReplTimeout();
+
List rsps = cache.getRPCManager().callRemoteMethods(callRecipients,
MethodDeclarations.replicateMethod,
new Object[]{call},
sync, // is synchronised?
true, // ignore self?
- configuration.getSyncReplTimeout());
+ syncReplTimeout);
if (log.isTraceEnabled())
{
log.trace("responses=" + rsps);
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2007-09-25 13:05:59 UTC (rev 4502)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2007-09-25 13:41:09 UTC (rev 4503)
@@ -117,7 +117,7 @@
//ctx.setMethodCall(m);
// Clean up the other nodes
- cleanBackupData(data, ctx.getGlobalTransaction());
+ cleanBackupData(data, ctx.getGlobalTransaction(), ctx);
}
}
}
@@ -140,13 +140,13 @@
case MethodDeclarations.prepareMethod_id:
case MethodDeclarations.optimisticPrepareMethod_id:
Object o = super.invoke(ctx);
- doPrepare(ctx.getGlobalTransaction());
+ doPrepare(ctx.getGlobalTransaction(), ctx);
return o;
case MethodDeclarations.rollbackMethod_id:
transactionMods.remove(ctx.getGlobalTransaction());
return super.invoke(ctx);
case MethodDeclarations.commitMethod_id:
- doCommit(ctx.getGlobalTransaction());
+ doCommit(ctx.getGlobalTransaction(), ctx);
transactionMods.remove(ctx.getGlobalTransaction());
return super.invoke(ctx);
}
@@ -180,7 +180,7 @@
return enabled;
}
- private void doPrepare(GlobalTransaction gtx) throws Throwable
+ private void doPrepare(GlobalTransaction gtx, InvocationContext ctx) throws Throwable
{
MethodCall cleanup = (MethodCall) transactionMods.get(gtx);
if (log.isTraceEnabled()) log.trace("Broadcasting prepare for cleanup ops " + cleanup);
@@ -198,7 +198,7 @@
prepare = MethodCallFactory.create(MethodDeclarations.prepareMethod, gtx, mods, cache.getLocalAddress(), syncCommunications);
}
- replicateCall(getMembersOutsideBuddyGroup(), prepare, syncCommunications);
+ replicateCall(getMembersOutsideBuddyGroup(), prepare, syncCommunications, ctx.getOptionOverrides());
}
else
{
@@ -206,12 +206,12 @@
}
}
- private void doCommit(GlobalTransaction gtx) throws Throwable
+ private void doCommit(GlobalTransaction gtx, InvocationContext ctx) throws Throwable
{
if (transactionMods.containsKey(gtx))
{
if (log.isTraceEnabled()) log.trace("Broadcasting commit for gtx " + gtx);
- replicateCall(getMembersOutsideBuddyGroup(), MethodCallFactory.create(MethodDeclarations.commitMethod, gtx), syncCommunications);
+ replicateCall(getMembersOutsideBuddyGroup(), MethodCallFactory.create(MethodDeclarations.commitMethod, gtx), syncCommunications, ctx.getOptionOverrides());
}
else
{
@@ -269,7 +269,7 @@
return result;
}
- private void cleanBackupData(BackupData backup, GlobalTransaction gtx) throws Throwable
+ private void cleanBackupData(BackupData backup, GlobalTransaction gtx, InvocationContext ctx) throws Throwable
{
// MethodCall primaryDataCleanup, backupDataCleanup;
// if (buddyManager.isDataGravitationRemoveOnFind())
@@ -296,7 +296,7 @@
if (log.isTraceEnabled()) log.trace("Performing cleanup on [" + backup.backupFqn + "]");
// remove backup Fqn
//replicateCall(cache.getMembers(), backupDataCleanup, syncCommunications);
- replicateCall(cache.getMembers(), cleanup, syncCommunications);
+ replicateCall(cache.getMembers(), cleanup, syncCommunications, ctx.getOptionOverrides());
}
else
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2007-09-25 13:05:59 UTC (rev 4502)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2007-09-25 13:41:09 UTC (rev 4503)
@@ -9,7 +9,6 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Option;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
@@ -81,7 +80,7 @@
{
// the no-tx case:
//replicate an evict call.
- invalidateAcrossCluster(fqn, null, isSynchronous(optionOverride));
+ invalidateAcrossCluster(fqn, null, isSynchronous(optionOverride), ctx);
}
}
}
@@ -117,7 +116,7 @@
{
try
{
- invalidateModifications(modifications, configuration.isNodeLockingOptimistic() ? getWorkspace(gtx) : null, defaultSynchronous);
+ invalidateModifications(modifications, configuration.isNodeLockingOptimistic() ? getWorkspace(gtx) : null, defaultSynchronous, ctx);
}
catch (Throwable t)
{
@@ -177,14 +176,15 @@
/**
* Same as <code>invalidateAcrossCluster(fqn, workspace, defaultSynchronous)</code>
- * @deprecated use {@link #invalidateAcrossCluster(Fqn, TransactionWorkspace, boolean)
+ *
+ * @deprecated use {@link #invalidateAcrossCluster(Fqn,TransactionWorkspace,boolean,InvocationContext)
*/
- protected void invalidateAcrossCluster(Fqn fqn, TransactionWorkspace workspace) throws Throwable
+ protected void invalidateAcrossCluster(Fqn fqn, TransactionWorkspace workspace, InvocationContext ctx) throws Throwable
{
- invalidateAcrossCluster(fqn, workspace, defaultSynchronous);
+ invalidateAcrossCluster(fqn, workspace, defaultSynchronous, ctx);
}
-
- protected void invalidateAcrossCluster(Fqn fqn, TransactionWorkspace workspace, boolean synchronous) throws Throwable
+
+ protected void invalidateAcrossCluster(Fqn fqn, TransactionWorkspace workspace, boolean synchronous, InvocationContext ctx) throws Throwable
{
// increment invalidations counter if statistics maintained
if (configuration.getExposeManagementStatistics() && getStatisticsEnabled())
@@ -200,23 +200,24 @@
if (log.isDebugEnabled()) log.debug("Cache [" + cache.getLocalAddress() + "] replicating " + call);
// voila, invalidated!
- replicateCall(call, synchronous);
+ replicateCall(call, synchronous, ctx.getOptionOverrides());
}
/**
* Same as <code>invalidateModifications(modifications, workspace, defaultSynchronous)</code>
- * @deprecated use {@link #invalidateAcrossCluster(org.jboss.cache.Fqn, org.jboss.cache.optimistic.TransactionWorkspace, boolean)}
+ *
+ * @deprecated use {@link #invalidateAcrossCluster(org.jboss.cache.Fqn,org.jboss.cache.optimistic.TransactionWorkspace,boolean,InvocationContext)}
*/
- protected void invalidateModifications(List<MethodCall> modifications, TransactionWorkspace workspace) throws Throwable
+ protected void invalidateModifications(List<MethodCall> modifications, TransactionWorkspace workspace, InvocationContext ctx) throws Throwable
{
- invalidateModifications(modifications, workspace, defaultSynchronous);
+ invalidateModifications(modifications, workspace, defaultSynchronous, ctx);
}
-
- protected void invalidateModifications(List<MethodCall> modifications, TransactionWorkspace workspace, boolean synchronous) throws Throwable
+
+ protected void invalidateModifications(List<MethodCall> modifications, TransactionWorkspace workspace, boolean synchronous, InvocationContext ctx) throws Throwable
{
// optimise the calls list here.
Set<Fqn> modifiedFqns = optimisedIterator(modifications);
- for (Fqn fqn : modifiedFqns) invalidateAcrossCluster(fqn, workspace, synchronous);
+ for (Fqn fqn : modifiedFqns) invalidateAcrossCluster(fqn, workspace, synchronous, ctx);
}
protected TransactionWorkspace getWorkspace(GlobalTransaction gtx)
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2007-09-25 13:05:59 UTC (rev 4502)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2007-09-25 13:41:09 UTC (rev 4503)
@@ -76,7 +76,7 @@
if (!gtx.isRemote() && ctx.isOriginLocal())
{
// replicate the prepare call.
- broadcastPrepare(m, gtx);
+ broadcastPrepare(m, gtx, ctx);
}
break;
case MethodDeclarations.commitMethod_id:
@@ -88,7 +88,7 @@
//we dont do anything
try
{
- broadcastCommit(gtx);
+ broadcastCommit(gtx, ctx);
}
catch (Throwable t)
{
@@ -112,7 +112,7 @@
//we dont do anything
try
{
- broadcastRollback(gtx);
+ broadcastRollback(gtx, ctx);
}
catch (Throwable t)
{
@@ -151,7 +151,7 @@
return gtx;
}
- protected void broadcastPrepare(MethodCall methodCall, GlobalTransaction gtx) throws Throwable
+ protected void broadcastPrepare(MethodCall methodCall, GlobalTransaction gtx, InvocationContext ctx) throws Throwable
{
boolean remoteCallSync = configuration.getCacheMode() == Configuration.CacheMode.REPL_SYNC;
@@ -175,7 +175,7 @@
+ " (" + num_mods + " modifications");
}
- replicateCall(toBroadcast, remoteCallSync);
+ replicateCall(toBroadcast, remoteCallSync, ctx.getOptionOverrides());
}
else
{
@@ -189,7 +189,7 @@
}
- protected void broadcastCommit(GlobalTransaction gtx) throws Throwable
+ protected void broadcastCommit(GlobalTransaction gtx, InvocationContext ctx) throws Throwable
{
boolean remoteCallSync = configuration.isSyncCommitPhase();
@@ -204,7 +204,7 @@
if (log.isDebugEnabled())
log.debug("running remote commit for " + gtx + " and coord=" + cache.getLocalAddress());
- replicateCall(commit_method, remoteCallSync);
+ replicateCall(commit_method, remoteCallSync, ctx.getOptionOverrides());
}
catch (Exception e)
{
@@ -214,7 +214,7 @@
}
}
- protected void broadcastRollback(GlobalTransaction gtx) throws Throwable
+ protected void broadcastRollback(GlobalTransaction gtx, InvocationContext ctx) throws Throwable
{
boolean remoteCallSync = configuration.isSyncRollbackPhase();
@@ -228,7 +228,7 @@
if (log.isDebugEnabled())
log.debug("running remote rollback for " + gtx + " and coord=" + cache.getLocalAddress());
- replicateCall(rollback_method, remoteCallSync);
+ replicateCall(rollback_method, remoteCallSync, ctx.getOptionOverrides());
}
catch (Exception e)
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2007-09-25 13:05:59 UTC (rev 4502)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2007-09-25 13:41:09 UTC (rev 4503)
@@ -53,7 +53,8 @@
{
case MethodDeclarations.commitMethod_id:
// REPL_ASYNC will result in only a prepare() method - 1 phase commit.
- if (containsModifications(ctx)) replicateCall(m, configuration.isSyncCommitPhase());
+ if (containsModifications(ctx))
+ replicateCall(m, configuration.isSyncCommitPhase(), ctx.getOptionOverrides());
// now pass up the chain
o = super.invoke(ctx);
break;
@@ -61,14 +62,14 @@
if (containsModifications(ctx))
{
// this is a prepare method
- runPreparePhase(m, gtx);
+ runPreparePhase(m, gtx, ctx);
}
break;
case MethodDeclarations.rollbackMethod_id:
// REPL_ASYNC will result in only a prepare() method - 1 phase commit.
if (containsModifications(ctx) && !ctx.isLocalRollbackOnly())
{
- replicateCall(m, configuration.isSyncRollbackPhase());
+ replicateCall(m, configuration.isSyncRollbackPhase(), ctx.getOptionOverrides());
}
// now pass up the chain
o = super.invoke(ctx);
@@ -82,11 +83,11 @@
{
// NON-TRANSACTIONAL and CRUD method
if (log.isTraceEnabled()) log.trace("Non-tx crud meth");
-
+
// don't re-broadcast if we've received this from another cache in the cluster.
if (ctx.isOriginLocal())
{
- handleReplicatedMethod(m, isSynchronous(optionOverride));
+ handleReplicatedMethod(m, isSynchronous(optionOverride), ctx);
}
}
else
@@ -97,7 +98,7 @@
return o;
}
- void handleReplicatedMethod(MethodCall m, boolean synchronous) throws Throwable
+ void handleReplicatedMethod(MethodCall m, boolean synchronous, InvocationContext ctx) throws Throwable
{
if (log.isTraceEnabled())
{
@@ -108,13 +109,13 @@
if (!synchronous || m.getMethodId() == MethodDeclarations.putForExternalReadMethodLocal_id)
{
// 2. Replicate change to all *other* members (exclude self !)
- replicateCall(m, false);
+ replicateCall(m, false, ctx.getOptionOverrides());
}
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);
+ replicateCall(m, true, ctx.getOptionOverrides());
}
}
@@ -132,7 +133,7 @@
*
* @throws Exception
*/
- protected void runPreparePhase(MethodCall prepareMethod, GlobalTransaction gtx) throws Throwable
+ protected void runPreparePhase(MethodCall prepareMethod, GlobalTransaction gtx, InvocationContext ctx) throws Throwable
{
boolean async = configuration.getCacheMode() == Configuration.CacheMode.REPL_ASYNC;
if (log.isTraceEnabled())
@@ -141,6 +142,6 @@
}
// this method will return immediately if we're the only member (because exclude_self=true)
- replicateCall(prepareMethod, !async);
+ replicateCall(prepareMethod, !async, ctx.getOptionOverrides());
}
}
17 years, 3 months
JBoss Cache SVN: r4502 - in core/trunk/src: main/java/org/jboss/cache/loader and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2007-09-25 09:05:59 -0400 (Tue, 25 Sep 2007)
New Revision: 4502
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
core/trunk/src/main/java/org/jboss/cache/RPCManager.java
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
Log:
JBCACHE-1186 - Use a JGroups RspFilter to filter responses for the clustered cache loader. Note that this imposes a dependency on JGroups 2.6.
Modified: core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-09-24 20:54:55 UTC (rev 4501)
+++ core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2007-09-25 13:05:59 UTC (rev 4502)
@@ -61,6 +61,7 @@
import org.jgroups.View;
import org.jgroups.blocks.GroupRequest;
import org.jgroups.blocks.RpcDispatcher;
+import org.jgroups.blocks.RspFilter;
import org.jgroups.util.Rsp;
import org.jgroups.util.RspList;
import org.jgroups.util.Util;
@@ -472,7 +473,7 @@
if (log.isWarnEnabled())
{
log.warn("Cannot fetch partial state, targets are " + sources +
- " and stateId is " + stateId);
+ " and stateId is " + stateId);
}
return;
}
@@ -555,7 +556,7 @@
* @throws Error
*/
private void handleLifecycleTransitionFailure(Throwable t)
- throws CacheException, RuntimeException, Error
+ throws CacheException, RuntimeException, Error
{
cacheStatus = CacheStatus.FAILED;
if (t instanceof CacheException)
@@ -839,7 +840,7 @@
catch (CacheException e)
{
log.warn("Needed to call stop() before destroying but stop() " +
- "threw exception. Proceeding to destroy", e);
+ "threw exception. Proceeding to destroy", e);
}
}
else
@@ -913,7 +914,7 @@
if (failed)
{
log.warn("Attempted to stop() from FAILED state, " +
- "but caught exception; try calling destroy()", t);
+ "but caught exception; try calling destroy()", t);
}
handleLifecycleTransitionFailure(t);
}
@@ -1044,7 +1045,7 @@
protected void createEvictionPolicy()
{
if (configuration.getEvictionConfig() != null
- && configuration.getEvictionConfig().isValidConfig())
+ && configuration.getEvictionConfig().isValidConfig())
{
regionManager.setEvictionConfig(configuration.getEvictionConfig());
regionManager.setUsingEvictions(true);
@@ -1146,8 +1147,8 @@
try
{
child = factory.createDataNode(name,
- subtree.getAncestor(i + 1),
- parent, null, true);
+ subtree.getAncestor(i + 1),
+ parent, null, true);
parent.addChild(name, child);
}
finally
@@ -1241,7 +1242,7 @@
if (broken && log.isTraceEnabled())
{
log.trace("Broke lock for node " + node.getFqn() +
- " held by " + deadOwner);
+ " held by " + deadOwner);
}
}
@@ -1293,7 +1294,7 @@
else
{
throw new CacheException("Initial state transfer failed: " +
- "Channel.getState() returned false");
+ "Channel.getState() returned false");
}
}
}
@@ -1422,7 +1423,7 @@
if (log.isTraceEnabled())
{
log.trace(new StringBuffer("_get(").append("\"").append(fqn).append("\", \"").append(key).append("\", \"").
- append(sendNodeEvent).append("\")"));
+ append(sendNodeEvent).append("\")"));
}
if (sendNodeEvent) notifier.notifyNodeVisited(fqn, true, ctx);
NodeSPI<K, V> n = findNode(fqn);
@@ -1848,8 +1849,9 @@
for (Object c : s)
{
NodeSPI child = (NodeSPI) c;
- if (!child.isDeleted()) {
- E e = (E)child.getFqn().getLastElement();
+ if (!child.isDeleted())
+ {
+ E e = (E) child.getFqn().getLastElement();
childNames.add(e);
}
}
@@ -2023,11 +2025,17 @@
@Deprecated
public List callRemoteMethods(List<Address> mbrs, MethodCall method_call,
boolean synchronous, boolean exclude_self, long timeout)
- throws Exception
+ throws Exception
{
return callRemoteMethods(mbrs, method_call, synchronous ? GroupRequest.GET_ALL : GroupRequest.GET_NONE, exclude_self, timeout);
}
+ @Deprecated
+ public List callRemoteMethods(List<Address> mbrs, MethodCall method_call, int mode, boolean exclude_self, long timeout)
+ throws Exception
+ {
+ return callRemoteMethods(mbrs, method_call, mode, exclude_self, timeout, null);
+ }
/**
* Overloaded to allow a finer grained control over JGroups mode
@@ -2042,8 +2050,8 @@
* @deprecated Note this is due to be moved to an interceptor.
*/
@Deprecated
- public List callRemoteMethods(List<Address> mbrs, MethodCall method_call, int mode, boolean exclude_self, long timeout)
- throws Exception
+ public List callRemoteMethods(List<Address> mbrs, MethodCall method_call, int mode, boolean exclude_self, long timeout, RspFilter rspFilter)
+ throws Exception
{
RspList rsps = null;
Rsp rsp;
@@ -2091,12 +2099,10 @@
if (channel.flushSupported())
{
flushBlockGate.await(configuration.getStateRetrievalTimeout());
- rsps = disp.callRemoteMethods(validMembers, method_call, mode, timeout, buddyManager != null && buddyManager.isEnabled());
}
- else
- {
- rsps = disp.callRemoteMethods(validMembers, method_call, mode, timeout, buddyManager != null && buddyManager.isEnabled());
- }
+ rsps = rspFilter == null
+ ? disp.callRemoteMethods(validMembers, method_call, mode, timeout, buddyManager != null && buddyManager.isEnabled())
+ : disp.callRemoteMethods(validMembers, method_call, mode, timeout, buddyManager != null && buddyManager.isEnabled(), false, rspFilter);
// a null response is 99% likely to be due to a marshalling problem - we throw a NSE, this needs to be changed when
// JGroups supports http://jira.jboss.com/jira/browse/JGRP-193
@@ -2154,7 +2160,7 @@
@Deprecated
public List callRemoteMethods(List<Address> members, Method method, Object[] args,
boolean synchronous, boolean exclude_self, long timeout)
- throws Exception
+ throws Exception
{
return callRemoteMethods(members, MethodCallFactory.create(method, args), synchronous, exclude_self, timeout);
}
@@ -2175,7 +2181,7 @@
public List callRemoteMethods(Vector<Address> members, String method_name,
Class[] types, Object[] args,
boolean synchronous, boolean exclude_self, long timeout)
- throws Exception
+ throws Exception
{
Method method = getClass().getDeclaredMethod(method_name, types);
return callRemoteMethods(members, method, args, synchronous, exclude_self, timeout);
@@ -2241,7 +2247,7 @@
* Otherwise they will not be created (used by rollback()).
*/
public void _put(GlobalTransaction tx, String fqn, Map<K, V> data, boolean create_undo_ops)
- throws CacheException
+ throws CacheException
{
_put(tx, Fqn.fromString(fqn), data, create_undo_ops);
}
@@ -2263,7 +2269,7 @@
* Otherwise they will not be created (used by rollback()).
*/
public void _put(GlobalTransaction tx, Fqn fqn, Map<K, V> data, boolean create_undo_ops)
- throws CacheException
+ throws CacheException
{
_put(tx, fqn, data, create_undo_ops, false);
}
@@ -2285,7 +2291,7 @@
* Otherwise they will not be created (used by rollback()).
*/
public void _put(GlobalTransaction tx, Fqn fqn, Map<K, V> data, boolean create_undo_ops, boolean erase_contents)
- throws CacheException
+ throws CacheException
{
if (log.isTraceEnabled())
{
@@ -2320,7 +2326,7 @@
* @return Previous value (if any)
*/
public Object _put(GlobalTransaction tx, String fqn, K key, V value, boolean create_undo_ops)
- throws CacheException
+ throws CacheException
{
return _put(tx, Fqn.fromString(fqn), key, value, create_undo_ops);
}
@@ -2330,9 +2336,9 @@
try
{
return tx != null && (
- tx.getStatus() == javax.transaction.Status.STATUS_ROLLEDBACK ||
- tx.getStatus() == javax.transaction.Status.STATUS_ROLLING_BACK ||
- tx.getStatus() == javax.transaction.Status.STATUS_MARKED_ROLLBACK);
+ tx.getStatus() == javax.transaction.Status.STATUS_ROLLEDBACK ||
+ tx.getStatus() == javax.transaction.Status.STATUS_ROLLING_BACK ||
+ tx.getStatus() == javax.transaction.Status.STATUS_MARKED_ROLLBACK);
}
catch (Exception e)
{
@@ -2347,12 +2353,12 @@
* @return Previous value (if any)
*/
public Object _put(GlobalTransaction tx, Fqn fqn, K key, V value, boolean create_undo_ops)
- throws CacheException
+ throws CacheException
{
if (log.isTraceEnabled())
{
log.trace(new StringBuffer("_put(").append(tx).append(", \"").
- append(fqn).append("\", k=").append(key).append(", v=").append(value).append(")"));
+ append(fqn).append("\", k=").append(key).append(", v=").append(value).append(")"));
}
@@ -2407,7 +2413,7 @@
}
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent)
- throws CacheException
+ throws CacheException
{
return _remove(tx, fqn, create_undo_ops, sendNodeEvent, false);
}
@@ -2421,7 +2427,7 @@
* @param sendNodeEvent
*/
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction)
- throws CacheException
+ throws CacheException
{
return _remove(tx, fqn, create_undo_ops, sendNodeEvent, eviction, null);
}
@@ -2441,7 +2447,7 @@
* @throws CacheException
*/
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction, DataVersion version)
- throws CacheException
+ throws CacheException
{
NodeSPI<K, V> n;
@@ -2551,7 +2557,7 @@
* @return Object
*/
public V _remove(GlobalTransaction tx, String fqn, K key, boolean create_undo_ops)
- throws CacheException
+ throws CacheException
{
return _remove(tx, Fqn.fromString(fqn), key, create_undo_ops);
}
@@ -2564,7 +2570,7 @@
* @return Object
*/
public V _remove(GlobalTransaction tx, Fqn fqn, K key, boolean create_undo_ops)
- throws CacheException
+ throws CacheException
{
MethodCall undo_op = null;
V old_value = null;
@@ -2609,7 +2615,7 @@
* Internal method to remove data from a node.
*/
public void _removeData(GlobalTransaction tx, String fqn, boolean create_undo_ops)
- throws CacheException
+ throws CacheException
{
_removeData(tx, Fqn.fromString(fqn), create_undo_ops);
}
@@ -2618,7 +2624,7 @@
* Internal method to remove data from a node.
*/
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops)
- throws CacheException
+ throws CacheException
{
_removeData(tx, fqn, create_undo_ops, true);
}
@@ -2627,7 +2633,7 @@
* Internal method to remove data from a node.
*/
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent)
- throws CacheException
+ throws CacheException
{
_removeData(tx, fqn, create_undo_ops, sendNodeEvent, false);
}
@@ -2636,7 +2642,7 @@
* Internal method to remove data from a node.
*/
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction)
- throws CacheException
+ throws CacheException
{
_removeData(tx, fqn, create_undo_ops, sendNodeEvent, eviction, null);
}
@@ -2645,7 +2651,7 @@
* Internal method to remove data from a node.
*/
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction, DataVersion version)
- throws CacheException
+ throws CacheException
{
MethodCall undo_op = null;
@@ -2673,7 +2679,7 @@
if (!data.isEmpty())
{
undo_op = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal,
- tx, fqn, new HashMap<K,V>(data), false);
+ tx, fqn, new HashMap<K, V>(data), false);
}
}
@@ -2790,10 +2796,10 @@
/**
* Very much like an evict(), except that regardless of whether there is a child present, this call will never
* remove the node from memory - just remove its contents.
- *
+ * <p/>
* Also, potentially throws a cache exception if data versioning is used and the node in memory has a newer data
* version than what is passed in.
- *
+ * <p/>
* Finally, the data version of the in-memory node is updated to the version being evicted to prevent versions
* going out of sync.
*
@@ -2823,7 +2829,7 @@
put(fqn, m);
getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
NodeSPI nodeSPI = (NodeSPI) root.getChild(fqn);
- nodeSPI.setVersion(versionToInvalidate);
+ nodeSPI.setVersion(versionToInvalidate);
}
}
@@ -2846,7 +2852,7 @@
* Compensating method to {@link #_remove(GlobalTransaction,Fqn,boolean)}.
*/
public void _addChild(GlobalTransaction gtx, Fqn parent_fqn, Object child_name, Node cn, boolean undoOps)
- throws CacheException
+ throws CacheException
{
NodeSPI childNode = (NodeSPI) cn;
if (log.isTraceEnabled())
@@ -2973,7 +2979,7 @@
* @return a GravitateResult which contains the data for the gravitation
*/
public GravitateResult gravitateData(Fqn fqn, boolean searchSubtrees)
- throws CacheException
+ throws CacheException
{
// we need to get the state for this Fqn and its sub-nodes.
@@ -3189,7 +3195,7 @@
* Should not be called.
*/
public void _lock(Fqn fqn, NodeLock.LockType lock_type, boolean recursive)
- throws TimeoutException, LockingException
+ throws TimeoutException, LockingException
{
throw new UnsupportedOperationException("method _lock() should not be invoked on CacheImpl");
}
@@ -3464,7 +3470,7 @@
else
{
log.error("Caught " + t.getClass().getName()
- + " while responding to state transfer request", t);
+ + " while responding to state transfer request", t);
}
}
@@ -3546,7 +3552,7 @@
out = new MarshalledValueOutputStream(baos);
getStateTransferManager().getState(out, Fqn.fromString(sourceRoot),
- configuration.getStateRetrievalTimeout(), true, true);
+ configuration.getStateRetrievalTimeout(), true, true);
}
catch (Throwable t)
{
@@ -4215,18 +4221,18 @@
protected String getDefaultProperties()
{
return "UDP(mcast_addr=224.0.0.36;mcast_port=55566;ip_ttl=32;" +
- "mcast_send_buf_size=150000;mcast_recv_buf_size=80000):" +
- "PING(timeout=1000;num_initial_members=2):" +
- "MERGE2(min_interval=5000;max_interval=10000):" +
- "FD_SOCK:" +
- "VERIFY_SUSPECT(timeout=1500):" +
- "pbcast.NAKACK(gc_lag=50;retransmit_timeout=600,1200,2400,4800):" +
- "UNICAST(timeout=600,1200,2400,4800):" +
- "pbcast.STABLE(desired_avg_gossip=20000):" +
- "FRAG(frag_size=8192):" +
- "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;" +
- "shun=false;print_local_addr=true):" +
- "pbcast.STATE_TRANSFER";
+ "mcast_send_buf_size=150000;mcast_recv_buf_size=80000):" +
+ "PING(timeout=1000;num_initial_members=2):" +
+ "MERGE2(min_interval=5000;max_interval=10000):" +
+ "FD_SOCK:" +
+ "VERIFY_SUSPECT(timeout=1500):" +
+ "pbcast.NAKACK(gc_lag=50;retransmit_timeout=600,1200,2400,4800):" +
+ "UNICAST(timeout=600,1200,2400,4800):" +
+ "pbcast.STABLE(desired_avg_gossip=20000):" +
+ "FRAG(frag_size=8192):" +
+ "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;" +
+ "shun=false;print_local_addr=true):" +
+ "pbcast.STATE_TRANSFER";
}
private void initialiseCacheLoaderManager() throws CacheException
@@ -4287,7 +4293,7 @@
if (log.isDebugEnabled())
{
log.debug("Created Multiplexer Channel for cache cluster " + configuration.getClusterName() +
- " using stack " + configuration.getMultiplexerStack());
+ " using stack " + configuration.getMultiplexerStack());
}
}
else
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManager.java 2007-09-24 20:54:55 UTC (rev 4501)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManager.java 2007-09-25 13:05:59 UTC (rev 4502)
@@ -2,12 +2,19 @@
import org.jboss.cache.marshall.MethodCall;
import org.jgroups.Address;
+import org.jgroups.blocks.RspFilter;
import java.lang.reflect.Method;
import java.util.List;
public interface RPCManager
{
+ /**
+ * The same as {@link #callRemoteMethods(java.util.List,org.jboss.cache.marshall.MethodCall,int,boolean,long)} except that it adds a JGroups
+ * {@link org.jgroups.blocks.RspFilter} to the list of parameters, which is used to filter results.
+ */
+ public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, int mode, boolean excludeSelf, long timeout, RspFilter responseFilter) throws Exception;
+
public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, int mode, boolean excludeSelf, long timeout) throws Exception;
public boolean isCoordinator();
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2007-09-24 20:54:55 UTC (rev 4501)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2007-09-25 13:05:59 UTC (rev 4502)
@@ -8,6 +8,7 @@
import org.jboss.cache.marshall.MethodCall;
import org.jgroups.Address;
+import org.jgroups.blocks.RspFilter;
import java.lang.reflect.Method;
import java.util.List;
@@ -36,6 +37,12 @@
// for now, we delegate RPC calls to deprecated methods in CacheImpl.
@SuppressWarnings("deprecation")
+ public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, int mode, boolean excludeSelf, long timeout, RspFilter responseFilter) throws Exception
+ {
+ return c.callRemoteMethods(recipients, methodCall, mode, excludeSelf, timeout, responseFilter);
+ }
+
+ @SuppressWarnings("deprecation")
public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, int mode, boolean excludeSelf, long timeout) throws Exception
{
return c.callRemoteMethods(recipients, methodCall, mode, excludeSelf, timeout);
Modified: core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java 2007-09-24 20:54:55 UTC (rev 4501)
+++ core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java 2007-09-25 13:05:59 UTC (rev 4502)
@@ -20,6 +20,7 @@
import org.jboss.cache.marshall.MethodDeclarations;
import org.jgroups.Address;
import org.jgroups.blocks.GroupRequest;
+import org.jgroups.blocks.RspFilter;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -87,7 +88,10 @@
if (log.isTraceEnabled()) log.trace("cache=" + cache.getLocalAddress() + "; calling with " + call);
List<Address> mbrs = cache.getMembers();
MethodCall clusteredGet = MethodCallFactory.create(MethodDeclarations.clusteredGetMethod, call, false);
- List resps = cache.getRPCManager().callRemoteMethods(mbrs, clusteredGet, GroupRequest.GET_FIRST, true, config.getTimeout());
+ List resps = null;
+ // JBCACHE-1186
+ resps = cache.getRPCManager().callRemoteMethods(mbrs, clusteredGet, GroupRequest.GET_FIRST, true, config.getTimeout(), new ResponseValidityFilter());
+
if (resps == null)
{
if (log.isInfoEnabled()) log.info("No replies to call " + call + ". Perhaps we're alone in the cluster?");
@@ -319,4 +323,25 @@
public void setRegionManager(RegionManager manager)
{
}
+
+ public static class ResponseValidityFilter implements RspFilter
+ {
+ private int numValidResponses = 0;
+
+ public boolean isAcceptable(Object object, Address address)
+ {
+ if (!(object instanceof List)) return false;
+
+ List response = (List) object;
+ Boolean foundResult = (Boolean) response.get(0);
+ if (foundResult) numValidResponses++;
+
+ return foundResult;
+ }
+
+ public boolean needMoreResponses()
+ {
+ return numValidResponses < 1;
+ }
+ }
}
Modified: core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java 2007-09-24 20:54:55 UTC (rev 4501)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java 2007-09-25 13:05:59 UTC (rev 4502)
@@ -6,16 +6,7 @@
*/
package org.jboss.cache.loader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.concurrent.CountDownLatch;
-
import junit.framework.Assert;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheImpl;
@@ -26,12 +17,22 @@
import org.jboss.cache.lock.TimeoutException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.CountDownLatch;
+
/**
* Tests ClusteredCacheLoader
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
*/
+@Test(groups = {"functional"})
public class ClusteredCacheLoaderTest extends AbstractCacheLoaderTestBase
{
private static Log log = LogFactory.getLog(ClusteredCacheLoaderTest.class);
17 years, 3 months
JBoss Cache SVN: r4501 - cacheloader-migration/trunk.
by jbosscache-commits@lists.jboss.org
Author: galder.zamarreno(a)jboss.com
Date: 2007-09-24 16:54:55 -0400 (Mon, 24 Sep 2007)
New Revision: 4501
Added:
cacheloader-migration/trunk/assembly.xml
Log:
Commit assembly file.
Added: cacheloader-migration/trunk/assembly.xml
===================================================================
--- cacheloader-migration/trunk/assembly.xml (rev 0)
+++ cacheloader-migration/trunk/assembly.xml 2007-09-24 20:54:55 UTC (rev 4501)
@@ -0,0 +1,67 @@
+<assembly>
+ <id>all</id>
+
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <includeBaseDirectory>true</includeBaseDirectory>
+
+ <fileSets>
+
+ <!-- code -->
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory/>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+
+ <!-- examples -->
+ <fileSet>
+ <directory>src/examples/java</directory>
+ <outputDirectory>examples/src</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>src/examples/resources</directory>
+ <outputDirectory>examples/resources</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>src/examples/data</directory>
+ <outputDirectory>examples/data</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>src/examples/misc</directory>
+ <outputDirectory>examples</outputDirectory>
+ </fileSet>
+
+ <!-- srcs -->
+ <fileSet>
+ <directory>src/main/java</directory>
+ <outputDirectory>src</outputDirectory>
+ </fileSet>
+
+ <!-- tests -->
+ <fileSet>
+ <directory>src/test/java</directory>
+ <outputDirectory>test</outputDirectory>
+ </fileSet>
+
+ <!-- test resources -->
+ <fileSet>
+ <directory>src/test/resources</directory>
+ <outputDirectory>test</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
+ <unpack>false</unpack>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+</assembly>
17 years, 3 months
JBoss Cache SVN: r4500 - in cacheloader-migration/trunk: src/examples/java/examples and 3 other directories.
by jbosscache-commits@lists.jboss.org
Author: galder.zamarreno(a)jboss.com
Date: 2007-09-24 16:54:20 -0400 (Mon, 24 Sep 2007)
New Revision: 4500
Removed:
cacheloader-migration/trunk/assembly.xml
Modified:
cacheloader-migration/trunk/pom.xml
cacheloader-migration/trunk/src/examples/java/examples/TransformStore.java
cacheloader-migration/trunk/src/examples/misc/build.xml
cacheloader-migration/trunk/src/examples/resources/original-fcl-service.xml
cacheloader-migration/trunk/src/examples/resources/original-jdbccl-service.xml
cacheloader-migration/trunk/src/examples/resources/transform-fcl-service.xml
cacheloader-migration/trunk/src/examples/resources/transform-jdbccl-service.xml
cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java
cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java
Log:
Fixed cache loader migration examples and added more verbose logging when reading nodes from cache loader.
Deleted: cacheloader-migration/trunk/assembly.xml
===================================================================
--- cacheloader-migration/trunk/assembly.xml 2007-09-24 17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/assembly.xml 2007-09-24 20:54:20 UTC (rev 4500)
@@ -1,67 +0,0 @@
-<assembly>
- <id>all</id>
-
- <formats>
- <format>zip</format>
- </formats>
-
- <includeBaseDirectory>true</includeBaseDirectory>
-
- <fileSets>
-
- <!-- code -->
- <fileSet>
- <directory>target</directory>
- <outputDirectory/>
- <includes>
- <include>*.jar</include>
- </includes>
- </fileSet>
-
- <!-- examples -->
- <fileSet>
- <directory>src/examples/java</directory>
- <outputDirectory>examples/src</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>src/examples/resources</directory>
- <outputDirectory>examples/resources</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>src/examples/data</directory>
- <outputDirectory>examples/data</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>src/examples/misc</directory>
- <outputDirectory>examples</outputDirectory>
- </fileSet>
-
- <!-- srcs -->
- <fileSet>
- <directory>src/main/java</directory>
- <outputDirectory>src</outputDirectory>
- </fileSet>
-
- <!-- tests -->
- <fileSet>
- <directory>src/test/java</directory>
- <outputDirectory>test</outputDirectory>
- </fileSet>
-
- <!-- test resources -->
- <fileSet>
- <directory>src/test/resources</directory>
- <outputDirectory>test</outputDirectory>
- </fileSet>
-
- </fileSets>
-
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
- <unpack>false</unpack>
- <scope>runtime</scope>
- </dependencySet>
- </dependencySets>
-</assembly>
Modified: cacheloader-migration/trunk/pom.xml
===================================================================
--- cacheloader-migration/trunk/pom.xml 2007-09-24 17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/pom.xml 2007-09-24 20:54:20 UTC (rev 4500)
@@ -4,12 +4,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
- <jbosscache-core-version>2.0.0</jbosscache-core-version>
+ <jbosscache-core-version>2.1.0-SNAPSHOT</jbosscache-core-version>
</properties>
<parent>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-common-parent</artifactId>
- <version>1.0</version>
+ <version>1.1-SNAPSHOT</version>
</parent>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-cacheloader-migration</artifactId>
@@ -33,6 +33,13 @@
<version>4.0.3.SP1</version>
</dependency>
+ <!-- overriding derby dependency so that is included in the assembly; derby is a runtime dependency so that cache loader migration examples can run -->
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.2.2.0</version>
+ </dependency>
+
</dependencies>
<build>
<plugins>
Modified: cacheloader-migration/trunk/src/examples/java/examples/TransformStore.java
===================================================================
--- cacheloader-migration/trunk/src/examples/java/examples/TransformStore.java 2007-09-24 17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/src/examples/java/examples/TransformStore.java 2007-09-24 20:54:20 UTC (rev 4500)
@@ -19,22 +19,25 @@
*/
public class TransformStore
{
- /* Type of cache loader, either use "jdbccl" for JDBCCacheLoader or "fcl" for FileCacheLoader */
+ /* Type of cache loader, either use "jdbccl" for JDBCCacheLoader or "fcl" for FileCacheLoader */
public static final String CL_TYPE = System.getProperty("cacheloader.type", "jdbccl");
+ /* Path of config file */
+ public static final String CL_CONFIG_PATH = System.getProperty("cacheloader.config.path", "resources/");
+
private static Log log = LogFactory.getLog(TransformStore.class);
public static void main(String[] args) throws Exception
{
TransformStore ts = new TransformStore();
- String transformConfigName = "transform-" + CL_TYPE + "-service.xml";
+ String transformConfigName = CL_CONFIG_PATH + "transform-" + CL_TYPE + "-service.xml";
log.info("Transforming configuration file: " + transformConfigName);
Cache transformingCache = ts.createAndStartCache(transformConfigName);
ts.transformCacheStore(transformingCache);
ts.stopAndDestroyCache(transformingCache);
- String originalConfigName = "original-" + CL_TYPE + "-service.xml";
+ String originalConfigName = CL_CONFIG_PATH + "original-" + CL_TYPE + "-service.xml";
log.info("Original configuration file: " + originalConfigName);
Cache checkingCache = ts.createAndStartCache(originalConfigName);
ts.checkCacheStore(checkingCache);
@@ -77,11 +80,25 @@
public void checkNode(Cache cache, Node<Object, Object> node)
{
- log.info("Node: " + node.getFqn() + " | Data: " + node.getData());
+ log.info(printNode(node));
for (Node child : node.getChildren())
{
checkNode(cache, child);
}
}
+
+ public String printNode(Node<Object, Object> node)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Node: ").append(node.getFqn())
+ .append(" | Data: ")
+ .append("[")
+ .append("capital=").append(node.get("capital")).append(",")
+ .append("currency=").append(node.get("currency")).append(",")
+ .append("population=").append(node.get("population"))
+ .append("]");
+
+ return sb.toString();
+ }
}
Modified: cacheloader-migration/trunk/src/examples/misc/build.xml
===================================================================
--- cacheloader-migration/trunk/src/examples/misc/build.xml 2007-09-24 17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/src/examples/misc/build.xml 2007-09-24 20:54:20 UTC (rev 4500)
@@ -18,7 +18,7 @@
<property name="filestore.zip" value="filecacheloader-1x.zip"/>
<path id="lib.classpath">
- <fileset dir="${cache.lib}">
+ <fileset dir="${cache.home}">
<include name="**/*.jar"/>
</fileset>
</path>
@@ -69,7 +69,7 @@
<java classname="examples.TransformStore" fork="yes">
<jvmarg value="-Dcacheloader.type=jdbccl"/>
- <jvmarg value="-Dlog4j.configuration=file:${basedir}/log4j-cache.xml"/>
+ <jvmarg value="-Dlog4j.configuration=file:${basedir}/resources/log4j-cache.xml"/>
<classpath refid="lib.classpath"/>
<classpath path="${build}"/>
</java>
@@ -82,7 +82,7 @@
<java classname="examples.TransformStore" fork="yes">
<jvmarg value="-Dcacheloader.type=fcl"/>
- <jvmarg value="-Dlog4j.configuration=file:${basedir}/log4j-cache.xml"/>
+ <jvmarg value="-Dlog4j.configuration=file:${basedir}/resources/log4j-cache.xml"/>
<classpath refid="lib.classpath"/>
<classpath path="${build}"/>
</java>
Modified: cacheloader-migration/trunk/src/examples/resources/original-fcl-service.xml
===================================================================
--- cacheloader-migration/trunk/src/examples/resources/original-fcl-service.xml 2007-09-24 17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/src/examples/resources/original-fcl-service.xml 2007-09-24 20:54:20 UTC (rev 4500)
@@ -133,7 +133,7 @@
-->
<attribute name="FetchInMemoryState">false</attribute>
- <attribute name="CacheLoaderConfiguration">
+ <attribute name="CacheLoaderConfig">
<config>
<!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
<passivation>false</passivation>
Modified: cacheloader-migration/trunk/src/examples/resources/original-jdbccl-service.xml
===================================================================
--- cacheloader-migration/trunk/src/examples/resources/original-jdbccl-service.xml 2007-09-24 17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/src/examples/resources/original-jdbccl-service.xml 2007-09-24 20:54:20 UTC (rev 4500)
@@ -133,7 +133,7 @@
-->
<attribute name="FetchInMemoryState">false</attribute>
- <attribute name="CacheLoaderConfiguration">
+ <attribute name="CacheLoaderConfig">
<config>
<!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
<passivation>false</passivation>
Modified: cacheloader-migration/trunk/src/examples/resources/transform-fcl-service.xml
===================================================================
--- cacheloader-migration/trunk/src/examples/resources/transform-fcl-service.xml 2007-09-24 17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/src/examples/resources/transform-fcl-service.xml 2007-09-24 20:54:20 UTC (rev 4500)
@@ -133,7 +133,7 @@
-->
<attribute name="FetchInMemoryState">false</attribute>
- <attribute name="CacheLoaderConfiguration">
+ <attribute name="CacheLoaderConfig">
<config>
<!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
<passivation>false</passivation>
Modified: cacheloader-migration/trunk/src/examples/resources/transform-jdbccl-service.xml
===================================================================
--- cacheloader-migration/trunk/src/examples/resources/transform-jdbccl-service.xml 2007-09-24 17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/src/examples/resources/transform-jdbccl-service.xml 2007-09-24 20:54:20 UTC (rev 4500)
@@ -133,7 +133,7 @@
-->
<attribute name="FetchInMemoryState">false</attribute>
- <attribute name="CacheLoaderConfiguration">
+ <attribute name="CacheLoaderConfig">
<config>
<!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
<passivation>false</passivation>
Modified: cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java
===================================================================
--- cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java 2007-09-24 17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingFileCacheLoaderTest.java 2007-09-24 20:54:20 UTC (rev 4500)
@@ -22,7 +22,7 @@
*
* @author <a href="mailto:galder.zamarreno@jboss.com">Galder Zamarreno</a>
*/
-@Test
+@Test(groups = {"functional"})
public class TransformingFileCacheLoaderTest extends TransformingCacheLoaderTestBase
{
private CacheImpl cache;
@@ -51,7 +51,6 @@
TestingUtil.recursiveFileRemove(targetLoc);
}
- @Test
public void testPutGetData() throws Exception
{
cache.start();
Modified: cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java
===================================================================
--- cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java 2007-09-24 17:15:43 UTC (rev 4499)
+++ cacheloader-migration/trunk/src/test/java/org/jboss/cache/loader/TransformingJDBCCacheLoaderTest.java 2007-09-24 20:54:20 UTC (rev 4500)
@@ -22,7 +22,7 @@
*
* @author <a href="mailto:galder.zamarreno@jboss.com">Galder Zamarreno</a>
*/
-@Test
+@Test(groups = {"functional"})
public class TransformingJDBCCacheLoaderTest extends TransformingCacheLoaderTestBase
{
private CacheImpl cache;
@@ -54,7 +54,6 @@
cache.destroy();
}
- @Test
public void testPutGetData() throws Exception
{
cache.start();
17 years, 3 months