Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 61   Methods: 4
NCLOC: 22   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LockStrategySerializable.java - 100% 100% 100%
coverage
 1    /*
 2    * JBoss, the OpenSource J2EE webOS
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache.lock;
 8   
 9    import java.util.concurrent.locks.Lock;
 10   
 11    //import org.jboss.logging.Logger;
 12   
 13    /**
 14    * Lock strategy of Serializable that prevents dirty read, non-repeatable read, and
 15    * phantom read.
 16    * <p> Dirty read allows (t1) write and then (t2) read within two separate threads, all without
 17    * transaction commit. </p>
 18    * <p> Non-repeatable read allows (t1) read, (t2) write, and then (t1) read, all without
 19    * transaction commit. </p>
 20    * <p> Phantom read allows (t1) read n rows, (t2) insert k rows, and (t1) read n+k rows.</p>
 21    *
 22    * @author <a href="mailto:bwang00@sourceforge.net">Ben Wang</a> July 15, 2003
 23    * @version $Revision: 1.4 $
 24    */
 25    public class LockStrategySerializable implements LockStrategy
 26    {
 27    // Log log=LogFactory.getLog(getClass());
 28   
 29    private SemaphoreLock sem_;
 30   
 31  24693 public LockStrategySerializable()
 32    {
 33  24693 sem_ = new SemaphoreLock(1);
 34    }
 35   
 36    /**
 37    * @see org.jboss.cache.lock.LockStrategy#readLock()
 38    */
 39  908420 public Lock readLock()
 40    {
 41  908419 return sem_;
 42    }
 43   
 44    /**
 45    * @see org.jboss.cache.lock.LockStrategy#upgradeLockAttempt(long)
 46    */
 47  2012 public Lock upgradeLockAttempt(long msecs) throws UpgradeException
 48    {
 49    // If we come to this far, that means the thread owns a rl already
 50    // so we just return the same lock
 51  2012 return sem_;
 52    }
 53   
 54    /**
 55    * @see org.jboss.cache.lock.LockStrategy#writeLock()
 56    */
 57  120211 public Lock writeLock()
 58    {
 59  120211 return sem_;
 60    }
 61    }