org.jboss.cache.lock
Class LockStrategyReadCommitted

java.lang.Object
  extended by org.jboss.cache.lock.LockStrategyReadCommitted
All Implemented Interfaces:
LockStrategy

public class LockStrategyReadCommitted
extends Object
implements LockStrategy

Transaction isolation level of READ_COMMITTED. Similar to read/write lock, but writers are not blocked on readers It prevents dirty read only.

Dirty read allows (t1) write and then (t2) read within two separate threads, all without transaction commit.

Version:
$Revision: 3125 $
Author:
Ben Wang

Constructor Summary
LockStrategyReadCommitted()
           
 
Method Summary
 Lock readLock()
          Return a read lock object.
 Lock upgradeLockAttempt(long msecs)
          Attempt to upgrade the current read lock to write lock with msecs timeout.
 Lock writeLock()
          Return a write lock object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockStrategyReadCommitted

public LockStrategyReadCommitted()
Method Detail

readLock

public Lock readLock()
Description copied from interface: LockStrategy
Return a read lock object.

Specified by:
readLock in interface LockStrategy
See Also:
LockStrategy.readLock()

upgradeLockAttempt

public Lock upgradeLockAttempt(long msecs)
                        throws UpgradeException
Description copied from interface: LockStrategy
Attempt to upgrade the current read lock to write lock with msecs timeout.

Specified by:
upgradeLockAttempt in interface LockStrategy
Parameters:
msecs - Timeout in milliseconds.
Returns:
Lock object. Will return null if timeout or failed.
Throws:
UpgradeException
See Also:
LockStrategy.upgradeLockAttempt(long)

writeLock

public Lock writeLock()
Description copied from interface: LockStrategy
Return a write lock object.

Specified by:
writeLock in interface LockStrategy
See Also:
LockStrategy.writeLock()


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.