01: package com.bostechcorp.cbesb.console.server;
02:
03: import com.bostechcorp.cbesb.console.common.JmxEndpointInfo;
04: import com.bostechcorp.cbesb.console.pub.JmxAssemblyObj;
05: import com.bostechcorp.cbesb.console.rpc.PollingNotification;
06:
07: public class PollingNotificationImpl extends JmxServiceServlet
08: implements PollingNotification {
09:
10: /**
11: *
12: */
13: private static final long serialVersionUID = -6943990019583512556L;
14:
15: public JmxEndpointInfo pollingStatusChange() {
16: return getStatusChange();
17: }
18:
19: public JmxAssemblyObj pollingStatusChangeBySA(String saName) {
20: return getStatusChangeBySA(saName);
21: }
22:
23: private JmxEndpointInfo getStatusChange() {
24: JmxEndpointInfo result = null;
25: try {
26: result = new JmxEndpointInfo();
27: result.setCallType(JmxEndpointInfo.WAIT_FOR_STATE_CHANGE);
28: long timeout = ConsoleSettingUtil
29: .getEndpointStatusRefreshRate(super
30: .getCurrentUserId());
31:
32: getClientFromSession().getStatusChange(timeout, result);
33: }
34:
35: catch (Throwable t) {
36: t.printStackTrace(System.out);
37: result.setException((Exception) t);
38: }
39: return result;
40: }
41:
42: private JmxAssemblyObj getStatusChangeBySA(String saName) {
43: JmxAssemblyObj result = null;
44: try {
45: result = new JmxAssemblyObj();
46: result.setName(saName);
47: result.setCallType(JmxAssemblyObj.WAIT_FOR_STATE_CHANGE);
48: long timeout = ConsoleSettingUtil
49: .getEndpointStatusRefreshRate(super
50: .getCurrentUserId());
51:
52: getClientFromSession().getStatusChangeBySA(timeout, result);
53: }
54:
55: catch (Throwable t) {
56: result.setException((Exception) t);
57: }
58: return result;
59: }
60:
61: public JmxAssemblyObj pollingStatisticsChangeBySA(String saName) {
62: JmxAssemblyObj result = null;
63: try {
64: result = new JmxAssemblyObj();
65: result.setName(saName);
66: result
67: .setCallType(JmxAssemblyObj.WAIT_FOR_STATISTICS_CHANGE);
68: long timeout = ConsoleSettingUtil
69: .getStatisticsRefreshRate(super .getCurrentUserId());
70: getClientFromSession().getStatisticsChangeBySA(timeout,
71: result);
72: }
73:
74: catch (Throwable t) {
75: result.setException((Exception) t);
76: }
77: return result;
78: }
79:
80: public JmxEndpointInfo pollingStatisticsChange() {
81: JmxEndpointInfo result = null;
82: try {
83: result = new JmxEndpointInfo();
84: result
85: .setCallType(JmxEndpointInfo.WAIT_FOR_STATISTICS_CHANGE);
86: long timeout = ConsoleSettingUtil
87: .getStatisticsRefreshRate(super .getCurrentUserId());
88: getClientFromSession().getStatisticsChange(timeout, result);
89: }
90:
91: catch (Throwable t) {
92: result.setException((Exception) t);
93: }
94: return result;
95:
96: }
97: }
|