javawebparts.misc
Class RecordedRequestPlayer.RunnerThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--javawebparts.misc.RecordedRequestPlayer.RunnerThread
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
RecordedRequestPlayer

public static class RecordedRequestPlayer.RunnerThread
extends java.lang.Thread

This is an inner class that is the thread which is spawned to run through the recorded requests.

Author:
Frank W. Zammetti.

Field Summary
private  int id
          The ID of this thread.
private  int numThreads
          The total number of threads running, for display purposss only.
private  int reps
          Number of repetitions this thread should perform.
private  int repsCount
          Count of the number of repetitions this thread has performed so far.
private  java.util.ArrayList requests
          The collection of requests this thread will run through.
private  int responseCode
          The response code retrieved from the last request made.
private  java.lang.String responseMessage
          The response message retrieved from the last request made.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RecordedRequestPlayer.RunnerThread()
           
 
Method Summary
private  void log(java.lang.StringBuffer sb)
          For every request that is made, a message is constructed with the results and some status information.
 void run()
          Main thread work method.
private  void sendRequest(java.lang.String theURL, java.lang.String method, java.util.HashMap params)
          This method is called to send a given request.
 void setID(int inID)
          Mutator for the ID of this thread.
 void setNumThreads(int inNumThreads)
          Mutator for the total number of threads running.
 void setReps(int inReps)
          Mutator for number of repetitions this thread will perform.
 void setRequests(java.util.ArrayList inRequests)
          Mutator for the array of requests this thread will run through.
 
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, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

reps

private int reps
Number of repetitions this thread should perform.


repsCount

private int repsCount
Count of the number of repetitions this thread has performed so far.


id

private int id
The ID of this thread.


requests

private java.util.ArrayList requests
The collection of requests this thread will run through.


responseCode

private int responseCode
The response code retrieved from the last request made.


responseMessage

private java.lang.String responseMessage
The response message retrieved from the last request made.


numThreads

private int numThreads
The total number of threads running, for display purposss only.

Constructor Detail

RecordedRequestPlayer.RunnerThread

public RecordedRequestPlayer.RunnerThread()
Method Detail

setReps

public void setReps(int inReps)
Mutator for number of repetitions this thread will perform.

Parameters:
inReps - The new value to set.

setID

public void setID(int inID)
Mutator for the ID of this thread.

Parameters:
inID - The new value to set.

setRequests

public void setRequests(java.util.ArrayList inRequests)
Mutator for the array of requests this thread will run through.

Parameters:
inRequests - The new value to set.

setNumThreads

public void setNumThreads(int inNumThreads)
Mutator for the total number of threads running.

Parameters:
inNumThreads - The new value to set.

run

public void run()
Main thread work method.

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

sendRequest

private void sendRequest(java.lang.String theURL,
                         java.lang.String method,
                         java.util.HashMap params)
This method is called to send a given request. It sets the responseCode and responseMethod class members upon completion. No exceptiosn are thrown, any that might be encountered are registered as a responseCode of -1 with the exception message as the responseMessage. It accepts the URL to call, the method used (GET or POST only) and a map of the parameters of the request. Note that at this point, only form encoding is supported, multipart, or anything else that might exist, is not explicitly supported.

Parameters:
theURL - The URL the request is made to.
method - The method used (GET or POST only).
params - The map of parameters of the request..

log

private void log(java.lang.StringBuffer sb)
For every request that is made, a message is constructed with the results and some status information. This information is logged when the request has completed (regardless of outcome). This method is called to log that message.

Parameters:
sb - The message to be logged.


Copyright 2005 Frank W. Zammetti