uk.org.iscream.cms.util
Class QueueMonitor

java.lang.Object
  extended byjava.lang.Thread
      extended byuk.org.iscream.cms.util.QueueMonitor
All Implemented Interfaces:
Runnable

class QueueMonitor
extends Thread

This class monitors a given Queue at regular intervals, reporting back to a Queue with XML - this could be the same Queue being monitored.

Version:
$Id: QueueMonitor.java,v 1.11 2003/02/05 14:27:59 tdb Exp $
Author:
$Author: tdb $

Field Summary
private  Queue _destQueue
          The Queue we'll output results to.
private  long _interval
          The interval at which we'll check the sourceQueue status.
private  String _name
          This is the friendly identifier of the component this class is running in.
private  boolean _run
          Allows us to stop the main loop cleanly.
private  Queue _sourceQueue
          The Queue we're monitoring.
private  String _srcName
          The name to identify the source Queue
static String REVISION
          The current CVS revision of this class
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
QueueMonitor(Queue sourceQueue, Queue destQueue, long interval, String name)
          Construct a new QueueMonitor.
 
Method Summary
 void run()
          Loops continuosly polling our source Queue at the given interval, and then logging the results in the destination Queue.
 void shutdown()
          Shuts down this QueueMonitor
 String toString()
          Overrides the Object.toString() method to provide clean logging (every class should have this).
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
The current CVS revision of this class

See Also:
Constant Field Values

_name

private String _name
This is the friendly identifier of the component this class is running in. eg, a Filter may be called "filter1", If this class does not have an owning component, a name from the configuration can be placed here. This name could also be changed to null for utility classes.


_sourceQueue

private Queue _sourceQueue
The Queue we're monitoring.


_destQueue

private Queue _destQueue
The Queue we'll output results to.


_interval

private long _interval
The interval at which we'll check the sourceQueue status.


_srcName

private String _srcName
The name to identify the source Queue


_run

private boolean _run
Allows us to stop the main loop cleanly.

Constructor Detail

QueueMonitor

public QueueMonitor(Queue sourceQueue,
                    Queue destQueue,
                    long interval,
                    String name)
Construct a new QueueMonitor.

Parameters:
sourceQueue - The Queue to monitor
destQueue - The Queue to monitor to
interval - The interval, in milliseconds, at which to sample
name - A name to identify the source Queue with
Method Detail

run

public void run()
Loops continuosly polling our source Queue at the given interval, and then logging the results in the destination Queue.


shutdown

public void shutdown()
Shuts down this QueueMonitor


toString

public String toString()
Overrides the Object.toString() method to provide clean logging (every class should have this). This uses the uk.org.iscream.cms.server.util.FormatName class to format the toString()

Returns:
the name of this class and its CVS revision


Copyright © 2000-2003 i-scream. All Rights Reserved.