[jbosscache-commits] JBoss Cache SVN: r7609 - in core/branches/flat/src: main/java/org/horizon/tree and 1 other directories.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Wed Jan 28 19:04:52 EST 2009
Author: manik.surtani at jboss.com
Date: 2009-01-28 19:04:52 -0500 (Wed, 28 Jan 2009)
New Revision: 7609
Modified:
core/branches/flat/src/main/java/org/horizon/lock/StripedLockManager.java
core/branches/flat/src/main/java/org/horizon/tree/NodeImpl.java
core/branches/flat/src/test/java/org/horizon/replication/ExceptionTest.java
Log:
Modified: core/branches/flat/src/main/java/org/horizon/lock/StripedLockManager.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/lock/StripedLockManager.java 2009-01-28 23:43:56 UTC (rev 7608)
+++ core/branches/flat/src/main/java/org/horizon/lock/StripedLockManager.java 2009-01-29 00:04:52 UTC (rev 7609)
@@ -40,14 +40,13 @@
import java.util.concurrent.locks.Lock;
/**
- * // TODO: MANIK: Document this
+ * Handles locks for the MVCC based LockingInterceptor
*
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
* @since 1.0
*/
public class StripedLockManager implements LockManager {
protected Configuration configuration;
- protected long lockAcquisitionTimeout;
LockContainer<Object> lockContainer;
private TransactionManager transactionManager;
private InvocationContextContainer invocationContextContainer;
@@ -63,7 +62,6 @@
@Start
public void startLockManager() {
- this.lockAcquisitionTimeout = configuration.getLockAcquisitionTimeout();
lockContainer = transactionManager == null ? new ReentrantLockContainer<Object>(configuration.getConcurrencyLevel()) : new OwnableReentrantLockContainer<Object>(configuration.getConcurrencyLevel(), invocationContextContainer);
}
@@ -74,7 +72,7 @@
public boolean lock(Object key, Object owner) throws InterruptedException {
if (trace) log.trace("Attempting to lock " + key);
Lock lock = lockContainer.getLock(key);
- return lock.tryLock(lockAcquisitionTimeout, MILLISECONDS);
+ return lock.tryLock(configuration.getLockAcquisitionTimeout(), MILLISECONDS);
}
public boolean lock(Object key, Object owner, long timeoutMillis) throws InterruptedException {
@@ -86,7 +84,7 @@
public boolean lockAndRecord(Object key, InvocationContext ctx) throws InterruptedException {
if (trace) log.trace("Attempting to lock " + key);
Lock lock = lockContainer.getLock(key);
- if (lock.tryLock(ctx.getLockAcquisitionTimeout(lockAcquisitionTimeout), MILLISECONDS)) {
+ if (lock.tryLock(ctx.getLockAcquisitionTimeout(configuration.getLockAcquisitionTimeout()), MILLISECONDS)) {
ctx.addKeyLocked(key);
return true;
}
Modified: core/branches/flat/src/main/java/org/horizon/tree/NodeImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/tree/NodeImpl.java 2009-01-28 23:43:56 UTC (rev 7608)
+++ core/branches/flat/src/main/java/org/horizon/tree/NodeImpl.java 2009-01-29 00:04:52 UTC (rev 7609)
@@ -121,9 +121,9 @@
if (childFqn != null) {
Node child = new NodeImpl(childFqn, cache);
child.removeChildren();
+ child.clearData(); // this is necessary in case we have a remove and then an add on the same node, in the same tx.
cache.remove(new NodeKey(childFqn, NodeKey.Type.DATA));
cache.remove(new NodeKey(childFqn, NodeKey.Type.STRUCTURE));
-// updateStructure(s);
return true;
}
Modified: core/branches/flat/src/test/java/org/horizon/replication/ExceptionTest.java
===================================================================
--- core/branches/flat/src/test/java/org/horizon/replication/ExceptionTest.java 2009-01-28 23:43:56 UTC (rev 7608)
+++ core/branches/flat/src/test/java/org/horizon/replication/ExceptionTest.java 2009-01-29 00:04:52 UTC (rev 7609)
@@ -49,12 +49,8 @@
}
}, 0);
- cache1.getConfiguration().setSyncReplTimeout(1); // 1ms. this is *bound* to fail.
+ cache1.getConfiguration().setSyncReplTimeout(1);
cache2.getConfiguration().setSyncReplTimeout(1);
-
- cache1.start();
- cache2.start();
-
TestingUtil.blockUntilViewsReceived(10000, cache1, cache2);
cache1.put("k", "v");
@@ -63,10 +59,6 @@
@Test(groups = "functional", expectedExceptions = {TimeoutException.class})
public void testLockAcquisitionTimeout() throws Exception {
cache2.getConfiguration().setLockAcquisitionTimeout(1);
-
- cache1.start();
- cache2.start();
-
TestingUtil.blockUntilViewsReceived(10000, cache1, cache2);
// get a lock on cache 2 and hold on to it.
More information about the jbosscache-commits
mailing list