1 4 package com.tc.object.lockmanager.api; 5 6 import com.tc.exception.ImplementMe; 7 import com.tc.object.lockmanager.impl.GlobalLockInfo; 8 import com.tc.object.session.SessionID; 9 import com.tc.object.tx.TransactionID; 10 import com.tc.object.tx.WaitInvocation; 11 12 import java.util.ArrayList ; 13 import java.util.Collection ; 14 import java.util.LinkedList ; 15 import java.util.List ; 16 17 20 public class TestLockManager implements ClientLockManager { 21 public final List locks = new ArrayList (); 22 public final List lockIDForCalls = new LinkedList (); 23 public final List waitCalls = new LinkedList (); 24 public final List notifyCalls = new LinkedList (); 25 public final List unlockCalls = new LinkedList (); 26 27 public void unlock(LockID id, ThreadID threadID) { 28 unlockCalls.add(new Object [] {id, threadID }); 29 } 30 31 public LockID lockIDFor(String id) { 32 lockIDForCalls.add(id); 33 return new LockID(id); 34 } 35 36 public void awardLock(SessionID sessionID, LockID id, ThreadID threadID, int type) { 37 return; 38 } 39 40 public void lock(LockID id, ThreadID threadID, int type) { 41 locks.add(new Object [] { id, threadID, new Integer (type) }); 42 } 43 44 public void wait(LockID lockID, ThreadID transactionID, WaitInvocation call, Object waitLock, 45 WaitListener listener) { 46 waitCalls.add(new Object [] { lockID, transactionID, call, waitLock, listener }); 47 } 48 49 public Notify notify(LockID lockID, ThreadID threadID, boolean all) { 50 notifyCalls.add(new Object [] { lockID, threadID, new Boolean (all) }); 51 return Notify.NULL; 52 } 53 54 public Collection addAllPendingLockRequestsTo(Collection c) { 55 return c; 56 } 57 58 public void pause() { 59 return; 60 } 61 62 public void starting() { 63 return; 64 } 65 public void unpause() { 66 return; 67 68 } 69 70 public boolean isStarting() { 71 return false; 72 } 73 74 public Collection addAllWaitersTo(Collection c) { 75 return c; 76 } 77 78 public Collection addAllHeldLocksTo(Collection c) { 79 return c; 80 } 81 82 public void notified(LockID lockID, ThreadID threadID) { 83 return; 84 } 85 86 public void recall(LockID lockID, ThreadID id, int level) { 87 return; 88 } 89 90 public void waitTimedOut(LockID lockID, ThreadID threadID) { 91 return; 92 } 93 94 public void runGC() { 95 return; 96 } 97 98 public boolean isLocked(LockID lockID) { 99 return lockIDForCalls.contains(lockID.asString()); 100 } 101 102 public int queueLength(LockID lockID, ThreadID threadID) { 103 throw new ImplementMe(); 104 } 105 106 public int localHeldCount(LockID lockID, int lockLevel, ThreadID threadID) { 107 throw new ImplementMe(); 108 } 109 110 public boolean isLocked(LockID lockID, ThreadID threadID) { 111 throw new ImplementMe(); 112 } 113 114 public boolean haveLock(LockID lockID, TransactionID requesterID) { 115 throw new ImplementMe(); 116 } 117 118 public void queryLockCommit(ThreadID threadID, GlobalLockInfo globalLockInfo) { 119 throw new ImplementMe(); 120 } 121 122 public int waitLength(LockID lockID, ThreadID threadID) { 123 throw new ImplementMe(); 124 } 125 126 public boolean tryLock(LockID id, ThreadID threadID, int type) { 127 throw new ImplementMe(); 128 } 129 130 public void cannotAwardLock(SessionID sessionID, LockID id, ThreadID threadID, int type) { 131 throw new ImplementMe(); 132 133 } 134 } 135 | Popular Tags |