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.3 by tdb, Mon Feb 26 00:36:10 2001 UTC vs.
Revision 1.10 by tdb, Tue May 21 16:47:19 2002 UTC

# Line 1 | Line 1
1 + /*
2 + * i-scream central monitoring system
3 + * http://www.i-scream.org.uk
4 + * Copyright (C) 2000-2002 i-scream
5 + *
6 + * This program is free software; you can redistribute it and/or
7 + * modify it under the terms of the GNU General Public License
8 + * as published by the Free Software Foundation; either version 2
9 + * of the License, or (at your option) any later version.
10 + *
11 + * This program is distributed in the hope that it will be useful,
12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 + * GNU General Public License for more details.
15 + *
16 + * You should have received a copy of the GNU General Public License
17 + * along with this program; if not, write to the Free Software
18 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 + */
20 +
21   //---PACKAGE DECLARATION---
22 < package uk.ac.ukc.iscream.util;
22 > package uk.org.iscream.cms.server.util;
23  
24   //---IMPORTS---
25 < import uk.ac.ukc.iscream.util.*;
25 > import uk.org.iscream.cms.server.util.*;
26  
27   /**
28   * This class monitors a given Queue at regular intervals,
# Line 34 | Line 54 | class QueueMonitor extends Thread {
54       * @param name A name to identify the source Queue with
55       */
56      public QueueMonitor (Queue sourceQueue, Queue destQueue, long interval, String name) {
57 +        // set the Thread name
58 +        setName("util.QueueMonitor");
59 +        
60          _sourceQueue = sourceQueue;
61          _destQueue = destQueue;
62          _interval = interval;
# Line 55 | Line 78 | class QueueMonitor extends Thread {
78              try { Thread.sleep(_interval); } catch(Exception e) {}
79              // check the Queue
80              String status = _sourceQueue.xmlStatus();
81 +            // get a hash of our Queue (for identification)
82 +            String hashCode = String.valueOf(_sourceQueue.hashCode());
83              // create some XML
84              String date = new Long(System.currentTimeMillis()/((long) 1000)).toString();
85 <            String xml = "<packet type=\"queueStat\" date=\""+date+"\" name=\""+_srcName+"\">" + status + "</packet>";
85 >            String xml = "<packet type=\"queueStat\" date=\""+date+"\" name=\""+_srcName+"\" hashCode=\""+hashCode+"\">" + status + "</packet>";
86              // write XML to destination Queue
87              _destQueue.add(xml);
88          }
# Line 69 | Line 94 | class QueueMonitor extends Thread {
94      public void shutdown() {
95          // this will stop the main loop
96          _run = false;
97 +        // get a hash of our Queue (for identification)
98 +        String hashCode = String.valueOf(_sourceQueue.hashCode());
99          // create some XML
100          String date = new Long(System.currentTimeMillis()/((long) 1000)).toString();
101 <        String xml = "<packet type=\"queueStat\" date=\""+date+"\" name=\""+_srcName+"\" shutdown=\"true\"></packet>";
101 >        String xml = "<packet type=\"queueStat\" date=\""+date+"\" name=\""+_srcName+"\" hashCode=\""+hashCode+"\" shutdown=\"true\"></packet>";
102          // write XML to destination Queue
103          _destQueue.add(xml);
104      }
# Line 80 | Line 107 | class QueueMonitor extends Thread {
107       * Overrides the {@link java.lang.Object#toString() Object.toString()}
108       * method to provide clean logging (every class should have this).
109       *
110 <     * This uses the uk.ac.ukc.iscream.util.FormatName class
110 >     * This uses the uk.org.iscream.cms.server.util.FormatName class
111       * to format the toString()
112       *
113       * @return the name of this class and its CVS revision

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines