01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.admin.sessions;
05:
06: import com.tc.management.exposed.SessionsProductMBean;
07: import com.tc.management.opentypes.adapters.ClassCreationCount;
08:
09: import javax.management.openmbean.TabularData;
10:
11: public class SessionsProductWrapper {
12: private SessionsProductMBean bean;
13:
14: private int requestCount;
15: private int requestCountPerSecond;
16: private int sessionWritePercentage;
17: private int sessionsCreatedPerMinute;
18: private int sessionsExpiredPerMinute;
19: private TabularData top10ClassesByObjectCreationCount;
20: private ClassCreationCount[] classCreationCount;
21:
22: public SessionsProductWrapper(SessionsProductMBean bean) {
23: this .bean = bean;
24:
25: requestCount = bean.getRequestCount();
26: requestCountPerSecond = bean.getRequestCountPerSecond();
27: sessionWritePercentage = bean.getSessionWritePercentage();
28: sessionsCreatedPerMinute = bean.getSessionsCreatedPerMinute();
29: sessionsExpiredPerMinute = bean.getSessionsExpiredPerMinute();
30:
31: try {
32: top10ClassesByObjectCreationCount = bean
33: .getTop10ClassesByObjectCreationCount();
34: if (top10ClassesByObjectCreationCount != null) {
35: classCreationCount = ClassCreationCount
36: .fromTabularData(top10ClassesByObjectCreationCount);
37: } else {
38: classCreationCount = new ClassCreationCount[0];
39: }
40: } catch (Exception e) {
41: classCreationCount = new ClassCreationCount[0];
42: }
43: }
44:
45: public int getRequestCount() {
46: return requestCount;
47: }
48:
49: public int getRequestCountPerSecond() {
50: return requestCountPerSecond;
51: }
52:
53: public int getSessionWritePercentage() {
54: return sessionWritePercentage;
55: }
56:
57: public int getSessionsCreatedPerMinute() {
58: return sessionsCreatedPerMinute;
59: }
60:
61: public int getSessionsExpiredPerMinute() {
62: return sessionsExpiredPerMinute;
63: }
64:
65: public TabularData getTop10ClassesByObjectCreationCount() {
66: return top10ClassesByObjectCreationCount;
67: }
68:
69: public ClassCreationCount[] getClassCreationCount() {
70: return classCreationCount;
71: }
72:
73: public void expireSession(String sessionId) {
74: bean.expireSession(sessionId);
75: }
76: }
|