1 package org.apache.ojb.otm.lock.isolation; 2 3 17 18 import org.apache.ojb.otm.core.Transaction; 19 import org.apache.ojb.otm.lock.LockingException; 20 import org.apache.ojb.otm.lock.ObjectLock; 21 22 30 public class ReadCommittedIsolation extends AbstractIsolation 31 { 32 33 36 public void readLock(Transaction tx, ObjectLock lock) 37 throws LockingException 38 { 39 Transaction writer = lock.getWriter(); 40 if (writer == null) 41 { 42 lock.readLock(tx); 43 if (lock.getWriter() != null) 44 { 45 lock.releaseLock(tx); 46 readLock(tx, lock); 47 } 48 } 49 else if (tx != writer) 50 { 51 lock.waitForTx(writer); 52 readLock(tx, lock); 53 } 54 } 56 57 60 public void writeLock(Transaction tx, ObjectLock lock) 61 throws LockingException 62 { 63 lock.writeLock(tx); 64 } 65 66 } 67 | Popular Tags |