ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/client/MonitorSkeleton.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/client/MonitorSkeleton.java (file contents):
Revision 1.6 by tdb, Thu Mar 15 22:08:36 2001 UTC vs.
Revision 1.7 by ajm, Thu Mar 22 17:56:58 2001 UTC

# Line 14 | Line 14 | import uk.org.iscream.componentmanager.*;
14   * @author  $Author$
15   * @version $Id$
16   */
17 < public abstract class MonitorSkeleton implements PluginMonitor {
17 > public abstract class MonitorSkeleton extends Thread implements PluginMonitor {
18  
19   //---FINAL ATTRIBUTES---
20      
# Line 22 | Line 22 | public abstract class MonitorSkeleton implements Plugi
22  
23   //---CONSTRUCTORS---
24  
25 +    public MonitorSkeleton() {
26 +        this.start();
27 +    }
28 +
29   //---PUBLIC METHODS---
30  
31 <    public abstract void analysePacket(XMLPacket packet);
31 >    public void run() {
32 >        try {
33 >            analysePacket((XMLPacket) getQueue().get(getQueueId()));
34 >        } catch (InvalidQueueException e) {
35 >            _logger.write(this.toString(), Logger.ERROR, "Unable to get queue.");
36 >        }
37 >    }
38 >    
39 >    protected abstract void analysePacket(XMLPacket packet);
40  
41 <    public void processAlert(int newThreshold, String attributeName, Register reg, String source, String currentValue) {
41 >    protected void processAlert(int newThreshold, String attributeName, Register reg, String source, String currentValue) {
42          // decide what threshold level we're on, if we've changed, record that
43          if (newThreshold != reg.getLastThresholdLevel()) {
44              reg.setLastThresholdLevel(newThreshold);
# Line 100 | Line 112 | public abstract class MonitorSkeleton implements Plugi
112  
113   //---ACCESSOR/MUTATOR METHODS---
114  
115 +    protected abstract Queue getQueue();
116 +    
117 +    protected int getQueueId() {
118 +        if (_qID == -1) {
119 +            _qID = getQueue().getQueue();
120 +        }
121 +        return _qID;
122 +    }
123 +
124   //---ATTRIBUTES---
125  
126      protected Logger _logger = ReferenceManager.getInstance().getLogger();
127  
128      protected Queue _alerterQueue = ClientMain._alerterQueue;
129 +    
130 +    protected int _qID = -1;
131  
132   //---STATIC ATTRIBUTES---
133  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines