[
https://jira.jboss.org/jira/browse/JBCACHE-1404?page=com.atlassian.jira.p...
]
Alexey Veklov updated JBCACHE-1404:
-----------------------------------
Description:
Read locks are released only on transaction commit/rollback when isolation level is
READ_COMMITED.
Here is TestCase:
import javax.transaction.TransactionManager;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.lock.IsolationLevel;
import com.db.fdr.test.TestCase;
public class ReadCommittedLockingTest extends TestCase {
private Cache cache;
private Fqn fqn = Fqn.fromString("/test/fqn");
protected void setUp() throws Exception {
final CacheFactory cf = new DefaultCacheFactory();
final Configuration configuration = new Configuration();
configuration.setCacheMode(Configuration.CacheMode.REPL_SYNC);
configuration.setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
configuration.setIsolationLevel(IsolationLevel.READ_COMMITTED);
cache = cf.createCache(configuration);
cache.create();
cache.start();
}
public void test() throws Exception {
final CacheSPI cacheSPI = (CacheSPI) cache;
final TransactionManager transactionManager = cacheSPI.getTransactionManager();
transactionManager.begin();
cache.put(fqn, "key", "value");
transactionManager.commit();
transactionManager.begin();
cache.get(fqn, "key");
assertEquals(IsolationLevel.READ_COMMITTED,
cache.getConfiguration().getIsolationLevel());
final NodeSPI nodeSPI = cacheSPI.peek(fqn, false);
assertFalse("Should not be locked", nodeSPI.getLock().isReadLocked());
transactionManager.commit();
}
}
was:
Read locks are released only on transaction commit/rollback time when isolation level is
READ_COMMITED.
Here is TestCase:
import javax.transaction.TransactionManager;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.lock.IsolationLevel;
import com.db.fdr.test.TestCase;
public class ReadCommittedLockingTest extends TestCase {
private Cache cache;
private Fqn fqn = Fqn.fromString("/test/fqn");
protected void setUp() throws Exception {
final CacheFactory cf = new DefaultCacheFactory();
final Configuration configuration = new Configuration();
configuration.setCacheMode(Configuration.CacheMode.REPL_SYNC);
configuration.setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
configuration.setIsolationLevel(IsolationLevel.READ_COMMITTED);
cache = cf.createCache(configuration);
cache.create();
cache.start();
}
public void test() throws Exception {
final CacheSPI cacheSPI = (CacheSPI) cache;
final TransactionManager transactionManager = cacheSPI.getTransactionManager();
transactionManager.begin();
cache.put(fqn, "key", "value");
transactionManager.commit();
transactionManager.begin();
cache.get(fqn, "key");
assertEquals(IsolationLevel.READ_COMMITTED,
cache.getConfiguration().getIsolationLevel());
final NodeSPI nodeSPI = cacheSPI.peek(fqn, false);
assertFalse("Should not be locked", nodeSPI.getLock().isReadLocked());
transactionManager.commit();
}
}
Read locks are not released when isolation level is READ_COMMITED
-----------------------------------------------------------------
Key: JBCACHE-1404
URL:
https://jira.jboss.org/jira/browse/JBCACHE-1404
Project: JBoss Cache
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Transactions
Affects Versions: 2.1.1.GA
Reporter: Alexey Veklov
Assignee: Manik Surtani
Read locks are released only on transaction commit/rollback when isolation level is
READ_COMMITED.
Here is TestCase:
import javax.transaction.TransactionManager;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.lock.IsolationLevel;
import com.db.fdr.test.TestCase;
public class ReadCommittedLockingTest extends TestCase {
private Cache cache;
private Fqn fqn = Fqn.fromString("/test/fqn");
protected void setUp() throws Exception {
final CacheFactory cf = new DefaultCacheFactory();
final Configuration configuration = new Configuration();
configuration.setCacheMode(Configuration.CacheMode.REPL_SYNC);
configuration.setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
configuration.setIsolationLevel(IsolationLevel.READ_COMMITTED);
cache = cf.createCache(configuration);
cache.create();
cache.start();
}
public void test() throws Exception {
final CacheSPI cacheSPI = (CacheSPI) cache;
final TransactionManager transactionManager = cacheSPI.getTransactionManager();
transactionManager.begin();
cache.put(fqn, "key", "value");
transactionManager.commit();
transactionManager.begin();
cache.get(fqn, "key");
assertEquals(IsolationLevel.READ_COMMITTED,
cache.getConfiguration().getIsolationLevel());
final NodeSPI nodeSPI = cacheSPI.peek(fqn, false);
assertFalse("Should not be locked", nodeSPI.getLock().isReadLocked());
transactionManager.commit();
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira