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

Comparing projects/cms/source/util/uk/org/iscream/cms/util/QueueMonitor.java (file contents):
Revision 1.1 by tdb, Mon Feb 12 02:20:23 2001 UTC vs.
Revision 1.6 by tdb, Tue Mar 13 02:19:49 2001 UTC

# Line 3 | Line 3 | package uk.ac.ukc.iscream.util;
3  
4   //---IMPORTS---
5   import uk.ac.ukc.iscream.util.*;
6 import uk.ac.ukc.iscream.componentmanager.*;
6  
7   /**
8   * This class monitors a given Queue at regular intervals,
# Line 35 | Line 34 | class QueueMonitor extends Thread {
34       * @param name A name to identify the source Queue with
35       */
36      public QueueMonitor (Queue sourceQueue, Queue destQueue, long interval, String name) {
37 +        // set the Thread name
38 +        setName("util.QueueMonitor");
39 +        
40          _sourceQueue = sourceQueue;
41          _destQueue = destQueue;
42          _interval = interval;
# Line 56 | Line 58 | class QueueMonitor extends Thread {
58              try { Thread.sleep(_interval); } catch(Exception e) {}
59              // check the Queue
60              String status = _sourceQueue.xmlStatus();
61 +            // get a hash of our Queue (for identification)
62 +            String hashCode = String.valueOf(_sourceQueue.hashCode());
63              // create some XML
64              String date = new Long(System.currentTimeMillis()/((long) 1000)).toString();
65 <            String xml = "<packet type=\"queueStat\" date=\""+date+"\" name=\""+_srcName+"\">" + status + "</packet>";
65 >            String xml = "<packet type=\"queueStat\" date=\""+date+"\" name=\""+_srcName+"\" hashCode=\""+hashCode+"\">" + status + "</packet>";
66              // write XML to destination Queue
67              _destQueue.add(xml);
68          }
# Line 70 | Line 74 | class QueueMonitor extends Thread {
74      public void shutdown() {
75          // this will stop the main loop
76          _run = false;
77 +        // get a hash of our Queue (for identification)
78 +        String hashCode = String.valueOf(_sourceQueue.hashCode());
79 +        // create some XML
80 +        String date = new Long(System.currentTimeMillis()/((long) 1000)).toString();
81 +        String xml = "<packet type=\"queueStat\" date=\""+date+"\" name=\""+_srcName+"\" hashCode=\""+hashCode+"\" shutdown=\"true\"></packet>";
82 +        // write XML to destination Queue
83 +        _destQueue.add(xml);
84      }
85      
86      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines