8 |
|
import java.util.*; |
9 |
|
|
10 |
|
/** |
11 |
< |
* A manager for the Monitors. |
11 |
> |
* A manager for the Alerters. |
12 |
|
* |
13 |
|
* @author $Author$ |
14 |
|
* @version $Id$ |
15 |
|
*/ |
16 |
< |
class AlerterManager extends Thread { |
16 |
> |
public class AlerterManager extends Thread { |
17 |
|
|
18 |
|
//---FINAL ATTRIBUTES--- |
19 |
|
|
87 |
|
} |
88 |
|
|
89 |
|
//---PUBLIC METHODS--- |
90 |
– |
|
91 |
– |
public void run() { |
92 |
– |
|
93 |
– |
boolean run=true; |
94 |
– |
while(run) { |
95 |
– |
// attempt to get some data from the Queue |
96 |
– |
Alert alert = null; |
97 |
– |
try { |
98 |
– |
alert = (Alert) _queue.get(_qID); |
99 |
– |
} |
100 |
– |
catch(InvalidQueueException e) { |
101 |
– |
_logger.write(toString(), Logger.ERROR, "Queue failure: "+e); |
102 |
– |
} |
103 |
– |
|
104 |
– |
// for each alerter in the pipeline... |
105 |
– |
Iterator pluginAlerters = _alerterPipeline.iterator(); |
106 |
– |
while (pluginAlerters.hasNext()){ |
107 |
– |
PluginAlerter alerter = (PluginAlerter)pluginAlerters.next(); |
108 |
– |
alerter.sendAlert(alert); |
109 |
– |
} |
110 |
– |
} |
111 |
– |
} |
90 |
|
|
91 |
|
/** |
92 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
107 |
|
//---PRIVATE METHODS--- |
108 |
|
|
109 |
|
//---ACCESSOR/MUTATOR METHODS--- |
110 |
+ |
|
111 |
+ |
/** |
112 |
+ |
* Allows alerters to obtain a reference |
113 |
+ |
* to the alerting queue so that they can |
114 |
+ |
* process any alerts |
115 |
+ |
* |
116 |
+ |
* @return a reference to the alert queue |
117 |
+ |
*/ |
118 |
+ |
public Queue getQueue() { |
119 |
+ |
return _queue; |
120 |
+ |
} |
121 |
|
|
122 |
|
//---ATTRIBUTES--- |
123 |
|
|