001: /*
002: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003: * notice. All rights reserved.
004: */
005: package com.tc.objectserver.lockmanager.api;
006:
007: import com.tc.async.api.Sink;
008: import com.tc.exception.ImplementMe;
009: import com.tc.net.groups.NodeID;
010: import com.tc.object.lockmanager.api.LockContext;
011: import com.tc.object.lockmanager.api.LockID;
012: import com.tc.object.lockmanager.api.ThreadID;
013: import com.tc.object.tx.WaitInvocation;
014:
015: import java.util.ArrayList;
016: import java.util.Collection;
017: import java.util.Iterator;
018: import java.util.List;
019: import java.util.Set;
020:
021: public class TestLockManager implements LockManager {
022:
023: public final List reestablishLockCalls = new ArrayList();
024: public final List reestablishWaitCalls = new ArrayList();
025: public final List startCalls = new ArrayList();
026: public final List notifyCalls = new ArrayList();
027:
028: public void notify(LockID lid, NodeID cid, ThreadID tid,
029: boolean all, NotifiedWaiters addNotifiedWaitersTo) {
030: notifyCalls.add(new Object[] { lid, cid, tid, new Boolean(all),
031: addNotifiedWaitersTo });
032: }
033:
034: public void wait(LockID lid, NodeID cid, ThreadID tid,
035: WaitInvocation waitInvocation, Sink lockResponseSink) {
036: throw new ImplementMe();
037: }
038:
039: public static final class WaitCallContext {
040: public final LockID lockID;
041: public final NodeID nid;
042: public final ThreadID threadID;
043: public final WaitInvocation waitInvocation;
044: public final Sink lockResponseSink;
045:
046: private WaitCallContext(LockID lockID, NodeID cid,
047: ThreadID tid, int level, WaitInvocation waitInvocation,
048: Sink lockResponseSink) {
049: this .lockID = lockID;
050: this .nid = cid;
051: this .threadID = tid;
052: this .waitInvocation = waitInvocation;
053: this .lockResponseSink = lockResponseSink;
054: }
055: }
056:
057: public boolean requestLock(LockID lockID, NodeID channelID,
058: ThreadID source, int level, Sink awardLockSink) {
059: throw new ImplementMe();
060: }
061:
062: public void unlock(LockID id, NodeID receiverID, ThreadID threadID) {
063: throw new ImplementMe();
064: }
065:
066: public boolean isLocked(LockID id) {
067: throw new ImplementMe();
068: }
069:
070: public boolean hasPending(LockID id) {
071: throw new ImplementMe();
072: }
073:
074: public void clearAllLocksFor(NodeID cid) {
075: return;
076: }
077:
078: public Iterator getAllLocks() {
079: throw new ImplementMe();
080: }
081:
082: public void scanForDeadlocks(DeadlockResults output) {
083: throw new ImplementMe();
084: }
085:
086: public void start() {
087: this .startCalls.add(new Object());
088: }
089:
090: public void stop() {
091: throw new ImplementMe();
092: }
093:
094: public void waitTimeout(LockWaitContext context) {
095: throw new ImplementMe();
096: }
097:
098: public void reestablishWait(LockID lid, NodeID cid, ThreadID tid,
099: int level, WaitInvocation waitInvocation,
100: Sink lockResponseSink) {
101: reestablishWaitCalls.add(new WaitCallContext(lid, cid, tid,
102: level, waitInvocation, lockResponseSink));
103: }
104:
105: public void reestablishLock(LockID lid, NodeID cid, ThreadID tid,
106: int level, Sink lockResponseSink) {
107: reestablishLockCalls
108: .add(new ReestablishLockContext(new LockContext(lid,
109: cid, tid, level), lockResponseSink));
110: }
111:
112: public static class ReestablishLockContext {
113: public final LockContext lockContext;
114: public final Sink lockResponseSink;
115:
116: private ReestablishLockContext(LockContext lockContext,
117: Sink lockResponseSink) {
118: this .lockContext = lockContext;
119: this .lockResponseSink = lockResponseSink;
120: }
121: }
122:
123: public void dump() {
124: throw new ImplementMe();
125: }
126:
127: public void queryLock(LockID lockID, NodeID cid, ThreadID threadID,
128: Sink lockResponseSink) {
129: throw new ImplementMe();
130: }
131:
132: public void interrupt(LockID lockID, NodeID cid, ThreadID threadID) {
133: throw new ImplementMe();
134: }
135:
136: public boolean tryRequestLock(LockID lockID, NodeID channelID,
137: ThreadID threadID, int level, WaitInvocation timeout,
138: Sink awardLockSink) {
139: throw new ImplementMe();
140: }
141:
142: public void recallCommit(LockID lid, NodeID cid,
143: Collection lockContexts, Collection waitContexts,
144: Collection pendingLockContexts,
145: Collection pendingTryLockContexts, Sink lockResponseSink) {
146: throw new ImplementMe();
147: }
148:
149: public void disableClientStat(LockID lockID,
150: Set statEnabledClients, Sink sink) {
151: throw new ImplementMe();
152: }
153:
154: public void enableClientStat(LockID lockID, Sink sink,
155: int lockStackTraceDepth, int lockStatCollectFrequency) {
156: throw new ImplementMe();
157: }
158: }
|