1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.miloss.fgsms.auxsrv;
22
23 import org.miloss.fgsms.common.DBSettingsLoader;
24 import org.miloss.fgsms.common.Logger;
25 import org.miloss.fgsms.services.interfaces.common.PolicyType;
26 import org.miloss.fgsms.services.interfaces.policyconfiguration.KeyNameValueEnc;
27 import org.miloss.fgsms.sla.AuxHelper;
28 import org.miloss.fgsms.sla.SLACommon;
29 import org.quartz.*;
30
31
32
33
34
35
36 public class HornetQScheduler implements StatefulJob {
37
38 private static Logger log = Logger.getLogger("fgsms.Agents");
39
40 public void execute(JobExecutionContext jec) throws JobExecutionException {
41 AuxHelper.TryUpdateStatus(true, "urn:fgsms:HornetqAgent:" + SLACommon.GetHostName(), "OK", true, PolicyType.STATUS, AuxHelper.UNSPECIFIED, SLACommon.GetHostName());
42 try {
43 KeyNameValueEnc item = DBSettingsLoader.GetPropertiesFromDB(true, "HornetQAgent", "URLs");
44 String t = null;
45 String[] urls = null;
46 try {
47 if (item != null) {
48 t = item.getKeyNameValue().getPropertyValue();
49 urls = t.split("\\|");
50 }
51 } catch (Exception ex) {
52 }
53
54 if (urls != null) {
55 for (int i = 0; i < urls.length; i++) {
56 String connecturl = urls[i];
57 String modifiedurl = org.miloss.fgsms.common.IpAddressUtility.modifyURL(connecturl, true);
58
59 org.miloss.fgsms.agents.HornetqJMSAgent.Fire(true, connecturl, modifiedurl);
60
61 }
62 }
63 } catch (Exception ex) {
64 log.log(org.apache.log4j.Level.WARN, "Could not start the HornetQAgent ", ex);
65 }
66
67
68
69 KeyNameValueEnc interval = DBSettingsLoader.GetPropertiesFromDB(true, "HornetQAgent", "Interval");
70 long intinterval = 30000;
71 if (interval != null) {
72 try {
73 intinterval = Long.parseLong(interval.getKeyNameValue().getPropertyValue());
74 if (intinterval < 1000) {
75 intinterval = 1000;
76 }
77 } catch (Exception ex) {
78 }
79 }
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99 }
100 }