Author: manik.surtani(a)jboss.com
Date: 2008-04-29 07:04:31 -0400 (Tue, 29 Apr 2008)
New Revision: 5744
Modified:
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/VersionedNode.java
Log:
Optimistic nodes should ignore isolation level
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-04-29 11:04:05 UTC
(rev 5743)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-04-29 11:04:31 UTC
(rev 5744)
@@ -47,7 +47,7 @@
* Lock manager that manages locks to be acquired when accessing the node inside a
transaction. Lazy set just in case
* locking is not needed.
*/
- private transient IdentityLock lock_ = null;
+ protected transient IdentityLock lock_ = null;
/**
* A reference of the CacheImpl instance.
@@ -60,7 +60,7 @@
*/
private final Map data = new HashMap();
- private NodeSPI delegate;
+ protected NodeSPI delegate;
private CommandsFactory commandsFactory;
/**
@@ -145,7 +145,7 @@
return cache.peek(fqn.getParent(), true);
}
- private synchronized void initLock()
+ protected synchronized void initLock()
{
if (lock_ == null)
{
Modified: core/trunk/src/main/java/org/jboss/cache/VersionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/VersionedNode.java 2008-04-29 11:04:05 UTC
(rev 5743)
+++ core/trunk/src/main/java/org/jboss/cache/VersionedNode.java 2008-04-29 11:04:31 UTC
(rev 5744)
@@ -7,6 +7,8 @@
package org.jboss.cache;
import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.lock.IdentityLock;
+import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.optimistic.DefaultDataVersion;
@@ -76,7 +78,16 @@
this.version = version;
}
+ /**
+ * Optimistically locked nodes (VersionedNodes) will always use repeatable read.
+ */
@Override
+ protected synchronized void initLock()
+ {
+ if (lock_ == null) lock_ = new IdentityLock(IsolationLevel.REPEATABLE_READ,
delegate);
+ }
+
+ @Override
public Map getInternalState(boolean onlyInternalState)
{
Map state = super.getInternalState(onlyInternalState);