KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > lockmanager > api > ClientLockManager


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.object.lockmanager.api;
5
6 import com.tc.object.lockmanager.impl.GlobalLockInfo;
7 import com.tc.object.session.SessionID;
8 import com.tc.object.tx.WaitInvocation;
9
10 import java.util.Collection JavaDoc;
11
12 /**
13  * Simple lock manager for the client
14  *
15  * @author steve
16  */

17 public interface ClientLockManager {
18
19   public void pause();
20
21   public void starting();
22
23   public void unpause();
24
25   public boolean isStarting();
26
27   /**
28    * obtain a lock
29    *
30    * @param obj
31    */

32   public void lock(LockID id, ThreadID threadID, int type);
33
34   public boolean tryLock(LockID id, ThreadID threadID, int type);
35
36   /**
37    * releases the lock so that others can have at it
38    *
39    * @param obj
40    */

41   public void unlock(LockID id, ThreadID threadID);
42
43   /**
44    * awards the lock to the threadID
45    */

46   public void awardLock(SessionID sessionID, LockID id, ThreadID threadID, int type);
47
48   public void cannotAwardLock(SessionID sessionID, LockID id, ThreadID threadID, int type);
49
50   public LockID lockIDFor(String JavaDoc id);
51
52   public void wait(LockID lockID, ThreadID threadID, WaitInvocation call, Object JavaDoc waitObject, WaitListener listener) throws InterruptedException JavaDoc;
53
54   public void waitTimedOut(LockID lockID, ThreadID threadID);
55
56   /**
57    * Returns true if this notification should be send to the server for handling. This nofication is not needed to be
58    * sent to the server if all is false and we have notified 1 waiter locally.
59    */

60   public Notify notify(LockID lockID, ThreadID threadID, boolean all);
61
62   /**
63    * Makes the lock wait for the given lock and thread a pending request.
64    */

65   public void notified(LockID lockID, ThreadID threadID);
66
67   /**
68    * Recalls a greedy Lock that was awarded earlier
69    */

70   public void recall(LockID lockID, ThreadID threadID, int level);
71
72   /**
73    * Adds all lock waits to the given collection and returns that collection.
74    *
75    * @param c
76    */

77   public Collection JavaDoc addAllWaitersTo(Collection JavaDoc c);
78
79   /**
80    * Adds all held locks to the given collection and returns that collection.
81    */

82   public Collection JavaDoc addAllHeldLocksTo(Collection JavaDoc c);
83
84   /**
85    * Causes all pending lock requests to be added to the collection.
86    */

87   public Collection JavaDoc addAllPendingLockRequestsTo(Collection JavaDoc c);
88
89   public void runGC();
90
91   public int queueLength(LockID lockID, ThreadID threadID);
92
93   public int waitLength(LockID lockID, ThreadID threadID);
94
95   public int localHeldCount(LockID lockID, int lockLevel, ThreadID threadID);
96
97   public boolean isLocked(LockID lockID, ThreadID threadID);
98
99   public void queryLockCommit(ThreadID threadID, GlobalLockInfo globalLockInfo);
100 }
101
Popular Tags