edu.wpi.prc.server.spotcheck
Class SpotCheckThread

java.lang.Object
  extended by java.lang.Thread
      extended by edu.wpi.prc.server.spotcheck.SpotCheckThread
All Implemented Interfaces:
java.lang.Runnable

public class SpotCheckThread
extends java.lang.Thread

Creates a specified number of spot checks by taking work units from the ingress work queue, computing their results, then adding the work units and results to the spot check queues.

Author:
James Baldassari

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  TransitionerQueue<WorkUnit> ingressWork
           
private  int minNumSpotChecks
           
private  java.lang.String scienceAppURI
           
private  TransitionerQueue<Result> spotCheckResults
           
private  TransitionerQueue<WorkUnit> spotCheckWork
           
private  org.apache.xmlrpc.XmlRpcClient xmlrpcClient
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SpotCheckThread(TransitionerQueue<WorkUnit> ingressWork, TransitionerQueue<WorkUnit> spotCheckWork, TransitionerQueue<Result> spotCheckResult, int minNumSpotChecks)
          Initializes the spot-check thread.
 
Method Summary
private  void initXmlRpcClient()
          Initializes the XML-RPC clients used for communicating with the project server and science application.
 void run()
          Creates as many spot checks as needed by invoking the science application via XML-RPC.
 void shutdown()
          Shuts down the SpotCheckThread.
private  void shutdownScienceApplication()
          Shuts down the science application via XML-RPC.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ingressWork

private TransitionerQueue<WorkUnit> ingressWork

spotCheckWork

private TransitionerQueue<WorkUnit> spotCheckWork

spotCheckResults

private TransitionerQueue<Result> spotCheckResults

minNumSpotChecks

private int minNumSpotChecks

scienceAppURI

private java.lang.String scienceAppURI

xmlrpcClient

private org.apache.xmlrpc.XmlRpcClient xmlrpcClient
Constructor Detail

SpotCheckThread

public SpotCheckThread(TransitionerQueue<WorkUnit> ingressWork,
                       TransitionerQueue<WorkUnit> spotCheckWork,
                       TransitionerQueue<Result> spotCheckResult,
                       int minNumSpotChecks)
Initializes the spot-check thread.

Parameters:
ingressWork - The transitioner's ingress work queue.
spotCheckWork - The transitioner's spot check work unit queue.
spotCheckResult - The transitioner's spot check result queue.
minNumSpotChecks - The number of required spot checks.
Method Detail

initXmlRpcClient

private void initXmlRpcClient()
Initializes the XML-RPC clients used for communicating with the project server and science application.


run

public void run()
Creates as many spot checks as needed by invoking the science application via XML-RPC.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

shutdownScienceApplication

private void shutdownScienceApplication()
Shuts down the science application via XML-RPC.


shutdown

public void shutdown()
Shuts down the SpotCheckThread. First, it attempts to shut down the science application via XML-RPC, then it interrupts itself to stop the thread.