1 4 package com.tc.objectserver.lockmanager.api; 5 6 import com.tc.async.api.Sink; 7 import com.tc.exception.ImplementMe; 8 import com.tc.net.protocol.tcm.ChannelID; 9 import com.tc.object.lockmanager.api.LockContext; 10 import com.tc.object.lockmanager.api.LockID; 11 import com.tc.object.lockmanager.api.ThreadID; 12 import com.tc.object.tx.WaitInvocation; 13 14 import java.util.ArrayList ; 15 import java.util.Collection ; 16 import java.util.Iterator ; 17 import java.util.List ; 18 19 public class TestLockManager implements LockManager { 20 21 public final List reestablishLockCalls = new ArrayList (); 22 public final List reestablishWaitCalls = new ArrayList (); 23 public final List startCalls = new ArrayList (); 24 public final List notifyCalls = new ArrayList (); 25 26 public void notify(LockID lid, ChannelID cid, ThreadID tid, boolean all, NotifiedWaiters addNotifiedWaitersTo) { 27 notifyCalls.add(new Object [] { lid, cid, tid, new Boolean (all), addNotifiedWaitersTo }); 28 } 29 30 public void wait(LockID lid, ChannelID cid, ThreadID tid, WaitInvocation waitInvocation, Sink lockResponseSink) { 31 throw new ImplementMe(); 32 } 33 34 public static final class WaitCallContext { 35 public final LockID lockID; 36 public final ChannelID channelID; 37 public final ThreadID threadID; 38 public final WaitInvocation waitInvocation; 39 public final Sink lockResponseSink; 40 41 private WaitCallContext(LockID lockID, ChannelID channelID, ThreadID tid, int level, WaitInvocation waitInvocation, 42 Sink lockResponseSink) { 43 this.lockID = lockID; 44 this.channelID = channelID; 45 this.threadID = tid; 46 this.waitInvocation = waitInvocation; 47 this.lockResponseSink = lockResponseSink; 48 } 49 } 50 51 public boolean requestLock(LockID lockID, ChannelID channelID, ThreadID source, int level, Sink awardLockSink) { 52 throw new ImplementMe(); 53 } 54 55 public void unlock(LockID id, ChannelID receiverID, ThreadID threadID) { 56 throw new ImplementMe(); 57 } 58 59 public boolean isLocked(LockID id) { 60 throw new ImplementMe(); 61 } 62 63 public boolean hasPending(LockID id) { 64 throw new ImplementMe(); 65 } 66 67 public void clearAllLocksFor(ChannelID channelID) { 68 return; 69 } 70 71 public Iterator getAllLocks() { 72 throw new ImplementMe(); 73 } 74 75 public void scanForDeadlocks(DeadlockResults output) { 76 throw new ImplementMe(); 77 } 78 79 public void start() { 80 this.startCalls.add(new Object ()); 81 } 82 83 public void stop() { 84 throw new ImplementMe(); 85 } 86 87 public void waitTimeout(LockWaitContext context) { 88 throw new ImplementMe(); 89 } 90 91 public void reestablishWait(LockID lid, ChannelID cid, ThreadID tid, int level, WaitInvocation waitInvocation, 92 Sink lockResponseSink) { 93 reestablishWaitCalls.add(new WaitCallContext(lid, cid, tid, level, waitInvocation, lockResponseSink)); 94 } 95 96 public void reestablishLock(LockID lid, ChannelID cid, ThreadID tid, int level, Sink lockResponseSink) { 97 reestablishLockCalls.add(new ReestablishLockContext(new LockContext(lid, cid, tid, level), lockResponseSink)); 98 } 99 100 public void recallCommit(LockID lid, ChannelID cid, Collection lockContexts, Collection waitContexts, 101 Collection pendingLockContexts, Sink lockResponseSink) { 102 throw new ImplementMe(); 103 } 104 105 public static class ReestablishLockContext { 106 public final LockContext lockContext; 107 public final Sink lockResponseSink; 108 109 private ReestablishLockContext(LockContext lockContext, Sink lockResponseSink) { 110 this.lockContext = lockContext; 111 this.lockResponseSink = lockResponseSink; 112 } 113 } 114 115 public void dump() { 116 throw new ImplementMe(); 117 } 118 119 public void queryLock(LockID lockID, ChannelID channelID, ThreadID threadID, Sink lockResponseSink) { 120 throw new ImplementMe(); 121 } 122 123 public boolean tryRequestLock(LockID lockID, ChannelID channelID, ThreadID threadID, int level, Sink awardLockSink) { 124 throw new ImplementMe(); 125 } 126 127 public void interrupt(LockID lockID, ChannelID channelID, ThreadID threadID) { 128 throw new ImplementMe(); 129 } 130 } | Popular Tags |