01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.management.beans;
05:
06: import com.tc.management.L2LockStatsManager;
07: import com.tc.object.lockmanager.api.LockID;
08:
09: import java.io.Serializable;
10: import java.util.Collection;
11:
12: public class LockStatisticsMonitor implements
13: LockStatisticsMonitorMBean, Serializable {
14: private final L2LockStatsManager lockStatsManager;
15:
16: public LockStatisticsMonitor(L2LockStatsManager lockStatsManager) {
17: this .lockStatsManager = lockStatsManager;
18: }
19:
20: public Collection getTopHeld(int n) {
21: return this .lockStatsManager.getTopLockHoldersStats(n);
22: }
23:
24: public Collection getTopAggregateLockHolderStats(int n) {
25: return this .lockStatsManager.getTopAggregateLockHolderStats(n);
26: }
27:
28: public Collection getTopRequested(int n) {
29: return this .lockStatsManager.getTopLockStats(n);
30: }
31:
32: public Collection getTopWaitingLocks(int n) {
33: return this .lockStatsManager.getTopWaitingLocks(n);
34: }
35:
36: public Collection getTopAggregateWaitingLocks(int n) {
37: return this .lockStatsManager.getTopAggregateWaitingLocks(n);
38: }
39:
40: public Collection getTopContendedLocks(int n) {
41: return this .lockStatsManager.getTopContendedLocks(n);
42: }
43:
44: public Collection getTopLockHops(int n) {
45: return this .lockStatsManager.getTopLockHops(n);
46: }
47:
48: public Collection getStackTraces(String lockID) {
49: return this .lockStatsManager.getStackTraces(new LockID(lockID));
50: }
51:
52: public void enableClientStackTrace(String lockID) {
53: this .lockStatsManager
54: .enableClientStackTrace(new LockID(lockID));
55: }
56:
57: public void enableClientStackTrace(String lockID,
58: int stackTraceDepth, int statCollectFrequency) {
59: this .lockStatsManager.enableClientStackTrace(
60: new LockID(lockID), stackTraceDepth,
61: statCollectFrequency);
62: }
63:
64: public void disableClientStackTrace(String lockID) {
65: this .lockStatsManager
66: .disableClientStackTrace(new LockID(lockID));
67: }
68:
69: public boolean isClientStackTraceEnabled(String lockID) {
70: return this .lockStatsManager
71: .isClientLockStackTraceEnable(new LockID(lockID));
72: }
73:
74: public void setLockStatisticsEnabled(boolean lockStatsEnabled) {
75: this .lockStatsManager
76: .setLockStatisticsEnabled(lockStatsEnabled);
77: }
78:
79: public boolean isLockStatisticsEnabled() {
80: return this.lockStatsManager.isLockStatisticsEnabled();
81: }
82: }
|