1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.miloss.fgsms.services.rs.impl;
21
22 import java.util.Queue;
23 import org.apache.log4j.Level;
24 import org.miloss.fgsms.services.interfaces.automatedreportingservice.ReportDefinition;
25 import org.miloss.fgsms.common.Logger;;
26
27
28
29
30
31
32
33 public class RSRunner implements Runnable {
34
35 private Queue<ReportDefinitionExtension> queue = null;
36
37 RSRunner(Queue<ReportDefinitionExtension> q) {
38 queue = q;
39 }
40 static final Logger log = Logger.getLogger("fgsms.RSProcessor");
41
42 @Override
43 public void run() {
44
45 ReportDefinitionExtension poll = queue.poll();
46 while (poll != null) {
47 try {
48 FgsmsReportGenerator r = new FgsmsReportGenerator();
49 String id = r.GenerateReport(poll.def, poll.pooled);
50 r.ProcessAlerts(poll.def, id, poll.pooled);
51 } catch (Exception e) {
52 log.log(Level.ERROR, "Error trapped running the reporting job", e);
53 }
54 poll = queue.poll();
55
56 }
57
58 RSProcessorSingleton.running = false;
59 log.log(org.apache.log4j.Level.INFO, "fgsms RSProcessor Alerting thread is terminating, queue is empty.");
60 }
61 }