001: /*
002: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003: * notice. All rights reserved.
004: */
005: package com.tc.management;
006:
007: import com.tc.async.api.Sink;
008: import com.tc.net.groups.NodeID;
009: import com.tc.object.lockmanager.api.LockID;
010: import com.tc.object.lockmanager.api.ThreadID;
011: import com.tc.object.net.DSOChannelManager;
012: import com.tc.objectserver.lockmanager.api.LockHolder;
013: import com.tc.objectserver.lockmanager.api.LockManager;
014:
015: import java.util.Collection;
016: import java.util.Collections;
017: import java.util.List;
018:
019: public interface L2LockStatsManager {
020: public final static L2LockStatsManager NULL_LOCK_STATS_MANAGER = new L2LockStatsManager() {
021: public void start(DSOChannelManager channelManager,
022: LockManager lockManager, Sink sink) {
023: // do nothing
024: }
025:
026: public void enableClientStackTrace(LockID lockID) {
027: // do nothing
028: }
029:
030: public void enableClientStackTrace(LockID lockID,
031: int stackTraceDepth, int statCollectFrequency) {
032: // do nothing
033: }
034:
035: public void disableClientStackTrace(LockID lockID) {
036: // do nothing
037: }
038:
039: public boolean isClientLockStackTraceEnable(LockID lockID) {
040: return false;
041: }
042:
043: public void lockRequested(LockID lockID, NodeID nodeID,
044: ThreadID threadID, int lockLevel) {
045: // do nothing
046: }
047:
048: public void lockAwarded(LockID lockID, NodeID nodeID,
049: ThreadID threadID, boolean isGreedy,
050: long lockAwardTimestamp) {
051: // do nothing
052: }
053:
054: public void lockReleased(LockID lockID, NodeID nodeID,
055: ThreadID threadID) {
056: // do nothing
057: }
058:
059: public void lockRejected(LockID lockID, NodeID nodeID,
060: ThreadID threadID) {
061: // do nothing
062: }
063:
064: public void lockWait(LockID lockID) {
065: // do nothing
066: }
067:
068: public void lockNotified(LockID lockID, int n) {
069: // do nothing
070: }
071:
072: public long getNumberOfLockRequested(LockID lockID) {
073: return 0;
074: }
075:
076: public long getNumberOfLockReleased(LockID lockID) {
077: return 0;
078: }
079:
080: public long getNumberOfPendingRequests(LockID lockID) {
081: return 0;
082: }
083:
084: public long getNumberOfLockHopRequests(LockID lockID) {
085: return 0;
086: }
087:
088: public LockHolder getLockHolder(LockID lockID, NodeID nodeID,
089: ThreadID threadID) {
090: return null;
091: }
092:
093: public Collection getTopLockStats(int n) {
094: return Collections.EMPTY_LIST;
095: }
096:
097: public Collection getTopLockHoldersStats(int n) {
098: return Collections.EMPTY_LIST;
099: }
100:
101: public Collection getTopWaitingLocks(int n) {
102: return Collections.EMPTY_LIST;
103: }
104:
105: public Collection getTopContendedLocks(int n) {
106: return Collections.EMPTY_LIST;
107: }
108:
109: public Collection getTopLockHops(int n) {
110: return Collections.EMPTY_LIST;
111: }
112:
113: public void recordStackTraces(LockID lockID, NodeID nodeID,
114: List stackTraces) {
115: // do nothing
116: }
117:
118: public Collection getStackTraces(LockID lockID) {
119: return Collections.EMPTY_LIST;
120: }
121:
122: public boolean isLockStackTraceEnabledInClient(LockID lockID,
123: NodeID nodeID) {
124: return false;
125: }
126:
127: public void recordClientStackTraceEnabled(LockID lockID,
128: NodeID nodeID) {
129: // do nothing
130: }
131:
132: public int getLockStackTraceDepth(LockID lockID) {
133: return 0;
134: }
135:
136: public int getLockStatCollectFrequency(LockID lockID) {
137: return 0;
138: }
139:
140: public void setLockStatisticsEnabled(boolean lockStatsEnabled) {
141: // do nothing
142: }
143:
144: public boolean isLockStatisticsEnabled() {
145: return false;
146: }
147:
148: public void enableLockStatistics() {
149: // do nothing
150: }
151:
152: public void disableLockStatistics() {
153: // do nothing
154: }
155:
156: public Collection getTopAggregateLockHolderStats(int n) {
157: return Collections.EMPTY_LIST;
158: }
159:
160: public Collection getTopAggregateWaitingLocks(int n) {
161: return Collections.EMPTY_LIST;
162: }
163:
164: public void lockHopped(LockID lockID) {
165: // do nothing
166: }
167:
168: public void clearAllStatsFor(NodeID nodeID) {
169: // do nothing
170: }
171: };
172:
173: public void start(DSOChannelManager channelManager,
174: LockManager lockManager, Sink sink);
175:
176: public void enableClientStackTrace(LockID lockID);
177:
178: public void enableClientStackTrace(LockID lockID,
179: int stackTraceDepth, int statCollectFrequency);
180:
181: public void disableClientStackTrace(LockID lockID);
182:
183: public boolean isClientLockStackTraceEnable(LockID lockID);
184:
185: public boolean isLockStackTraceEnabledInClient(LockID lockID,
186: NodeID nodeID);
187:
188: public void recordClientStackTraceEnabled(LockID lockID,
189: NodeID nodeID);
190:
191: public void lockHopped(LockID lockID);
192:
193: public void lockRequested(LockID lockID, NodeID nodeID,
194: ThreadID threadID, int lockLevel);
195:
196: public void lockAwarded(LockID lockID, NodeID nodeID,
197: ThreadID threadID, boolean isGreedy, long lockAwardTimestamp);
198:
199: public void lockReleased(LockID lockID, NodeID nodeID,
200: ThreadID threadID);
201:
202: public void lockRejected(LockID lockID, NodeID nodeID,
203: ThreadID threadID);
204:
205: public void lockWait(LockID lockID);
206:
207: public void lockNotified(LockID lockID, int n);
208:
209: public void recordStackTraces(LockID lockID, NodeID nodeID,
210: List stackTraces);
211:
212: public long getNumberOfLockRequested(LockID lockID);
213:
214: public long getNumberOfLockReleased(LockID lockID);
215:
216: public long getNumberOfPendingRequests(LockID lockID);
217:
218: public long getNumberOfLockHopRequests(LockID lockID);
219:
220: public LockHolder getLockHolder(LockID lockID, NodeID nodeID,
221: ThreadID threadID);
222:
223: public Collection getTopLockStats(int n);
224:
225: public Collection getTopAggregateLockHolderStats(int n);
226:
227: public Collection getTopLockHoldersStats(int n);
228:
229: public Collection getTopAggregateWaitingLocks(int n);
230:
231: public Collection getTopWaitingLocks(int n);
232:
233: public Collection getTopContendedLocks(int n);
234:
235: public Collection getTopLockHops(int n);
236:
237: public Collection getStackTraces(LockID lockID);
238:
239: public int getLockStackTraceDepth(LockID lockID);
240:
241: public int getLockStatCollectFrequency(LockID lockID);
242:
243: public void setLockStatisticsEnabled(boolean lockStatsEnabled);
244:
245: public boolean isLockStatisticsEnabled();
246:
247: public void clearAllStatsFor(NodeID nodeID);
248: }
|