1 8 9 package com.sleepycat.je.txn; 10 11 import com.sleepycat.je.DatabaseException; 12 import com.sleepycat.je.dbi.EnvironmentImpl; 13 14 32 public class BuddyLocker extends BasicLocker { 33 34 private Locker buddy; 35 36 39 public BuddyLocker(EnvironmentImpl env, Locker buddy) 40 throws DatabaseException { 41 42 super(env); 43 this.buddy = buddy; 44 } 45 46 49 Locker getBuddy() { 50 return buddy; 51 } 52 53 56 public Txn getTxnLocker() { 57 return buddy.getTxnLocker(); 58 } 59 60 65 public Locker newNonTxnLocker() 66 throws DatabaseException { 67 68 return new BuddyLocker(envImpl, buddy.newNonTxnLocker()); 69 } 70 71 74 public void releaseNonTxnLocks() 75 throws DatabaseException { 76 77 super.releaseNonTxnLocks(); 78 buddy.releaseNonTxnLocks(); 79 } 80 81 84 public boolean sharesLocksWith(Locker other) { 85 86 if (super.sharesLocksWith(other)) { 87 return true; 88 } else { 89 return buddy == other; 90 } 91 } 92 } 93 | Popular Tags |