org.jboss.cache.lock
Class LockStrategySerializable

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

public class LockStrategySerializable
extends java.lang.Object
implements LockStrategy

Lock strategy of Serializable that prevents dirty read, non-repeatable read, and phantom read.

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

Non-repeatable read allows (t1) read, (t2) write, and then (t1) read, all without transaction commit.

Phantom read allows (t1) read n rows, (t2) insert k rows, and (t1) read n+k rows.

Version:
$Revision: 1.4 $
Author:
Ben Wang July 15, 2003

Constructor Summary
LockStrategySerializable()
           
 
Method Summary
 java.util.concurrent.locks.Lock readLock()
          Return a read lock object.
 java.util.concurrent.locks.Lock upgradeLockAttempt(long msecs)
          Attempt to upgrade the current read lock to write lock with msecs timeout.
 java.util.concurrent.locks.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

LockStrategySerializable

public LockStrategySerializable()
Method Detail

readLock

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

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

upgradeLockAttempt

public java.util.concurrent.locks.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 java.util.concurrent.locks.Lock writeLock()
Description copied from interface: LockStrategy
Return a write lock object.

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