wt.queue
Class PollingQueueThread

java.lang.Object
  extended byjava.lang.Thread
      extended bywt.queue.PollingQueueThread
All Implemented Interfaces:
Runnable

class PollingQueueThread
extends Thread

This class implements the logic to run a polling or FIFO style queue


Field Summary
private static long DEFAULT_INTERVAL
           
private  boolean exitThread
           
private  long interval
           
private  int nWakes
           
private static boolean POLL_VERBOSE
           
private  ProcessingQueue queue
           
private  QueueMonitorHelper queueMonitorHelper
           
private  String queueName
           
private  String queueSignal
           
private static boolean VERBOSE
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PollingQueueThread(long interval, WtQueue aQueue)
          PollingQueueThread public constructor

Supported API: true
 
Method Summary
private  long getInterval(boolean suspend)
          Calculate an appropriate sleep time for process thread taking into consideration queue suspension
private  boolean queueActive()
          check to see if queue is active

Supported API: false
 void run()
          Standard run method for a Thread
 void setExit(boolean ex)
          Synchronized method to set exit for the polling thread

Supported API: true
 void setInterval(long interval)
          Synchronized method to set polling thread interval

Supported API: true
 void setQueue(WtQueue queue)
           
private  void setRunning(ProcessingQueue aQueue, boolean run)
          Sets the queues running state in the db

Supported API: true
 void startProcessing()
          signals the polling thread that there is work to do

Supported API: true
 String toString()
          Polling queue toString method

Supported API: true
 
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

interval

private long interval

nWakes

private int nWakes

exitThread

private boolean exitThread

queue

private ProcessingQueue queue

queueName

private String queueName

queueSignal

private String queueSignal

queueMonitorHelper

private QueueMonitorHelper queueMonitorHelper

VERBOSE

private static boolean VERBOSE

POLL_VERBOSE

private static boolean POLL_VERBOSE

DEFAULT_INTERVAL

private static long DEFAULT_INTERVAL
Constructor Detail

PollingQueueThread

public PollingQueueThread(long interval,
                          WtQueue aQueue)
PollingQueueThread public constructor

Supported API: true

Parameters:
interval -
aQueue -
Method Detail

setExit

public void setExit(boolean ex)
Synchronized method to set exit for the polling thread

Supported API: true

Parameters:
ex -

setInterval

public void setInterval(long interval)
Synchronized method to set polling thread interval

Supported API: true

Parameters:
interval -

run

public void run()
Standard run method for a Thread


startProcessing

public void startProcessing()
signals the polling thread that there is work to do

Supported API: true


queueActive

private boolean queueActive()
check to see if queue is active

Supported API: false

Returns:
boolean

toString

public String toString()
Polling queue toString method

Supported API: true

Returns:
String

setRunning

private void setRunning(ProcessingQueue aQueue,
                        boolean run)
Sets the queues running state in the db

Supported API: true

Parameters:
aQueue -
run -

getInterval

private long getInterval(boolean suspend)
Calculate an appropriate sleep time for process thread taking into consideration queue suspension


setQueue

public void setQueue(WtQueue queue)