--- projects/cms/source/util/uk/org/iscream/cms/util/QueueMonitor.java 2001/02/12 02:20:23 1.1 +++ projects/cms/source/util/uk/org/iscream/cms/util/QueueMonitor.java 2001/03/14 23:25:29 1.7 @@ -1,9 +1,8 @@ //---PACKAGE DECLARATION--- -package uk.ac.ukc.iscream.util; +package uk.org.iscream.util; //---IMPORTS--- -import uk.ac.ukc.iscream.util.*; -import uk.ac.ukc.iscream.componentmanager.*; +import uk.org.iscream.util.*; /** * This class monitors a given Queue at regular intervals, @@ -11,7 +10,7 @@ import uk.ac.ukc.iscream.componentmanager.*; * same Queue being monitored. * * @author $Author: tdb $ - * @version $Id: QueueMonitor.java,v 1.1 2001/02/12 02:20:23 tdb Exp $ + * @version $Id: QueueMonitor.java,v 1.7 2001/03/14 23:25:29 tdb Exp $ */ class QueueMonitor extends Thread { @@ -20,7 +19,7 @@ class QueueMonitor extends Thread { /** * The current CVS revision of this class */ - public static final String REVISION = "$Revision: 1.1 $"; + public static final String REVISION = "$Revision: 1.7 $"; //---STATIC METHODS--- @@ -35,6 +34,9 @@ class QueueMonitor extends Thread { * @param name A name to identify the source Queue with */ public QueueMonitor (Queue sourceQueue, Queue destQueue, long interval, String name) { + // set the Thread name + setName("util.QueueMonitor"); + _sourceQueue = sourceQueue; _destQueue = destQueue; _interval = interval; @@ -56,9 +58,11 @@ class QueueMonitor extends Thread { try { Thread.sleep(_interval); } catch(Exception e) {} // check the Queue String status = _sourceQueue.xmlStatus(); + // get a hash of our Queue (for identification) + String hashCode = String.valueOf(_sourceQueue.hashCode()); // create some XML String date = new Long(System.currentTimeMillis()/((long) 1000)).toString(); - String xml = "" + status + ""; + String xml = "" + status + ""; // write XML to destination Queue _destQueue.add(xml); } @@ -70,13 +74,20 @@ class QueueMonitor extends Thread { public void shutdown() { // this will stop the main loop _run = false; + // get a hash of our Queue (for identification) + String hashCode = String.valueOf(_sourceQueue.hashCode()); + // create some XML + String date = new Long(System.currentTimeMillis()/((long) 1000)).toString(); + String xml = ""; + // write XML to destination Queue + _destQueue.add(xml); } /** * Overrides the {@link java.lang.Object#toString() Object.toString()} * method to provide clean logging (every class should have this). * - * This uses the uk.ac.ukc.iscream.util.FormatName class + * This uses the uk.org.iscream.util.FormatName class * to format the toString() * * @return the name of this class and its CVS revision