org.objectweb.cjdbc.scenario.tools.util
Class RequestSender

java.lang.Object
  extended byorg.objectweb.cjdbc.scenario.tools.util.RequestSender
All Implemented Interfaces:
java.lang.Runnable

public class RequestSender
extends java.lang.Object
implements java.lang.Runnable

This class defines a RequestSender. This will send request in the background.

Version:
1.0
Author:
Nicolas Modrzyk

Field Summary
(package private)  long average
           
(package private)  int commitIntervalMax
           
(package private)  java.sql.Connection con
           
(package private) static int DO_COMMIT_RAND_NUMBER
           
(package private) static int DO_WRITE_EVERY
           
(package private)  int doWriteEvery
           
(package private)  java.util.ArrayList exceptions
           
(package private) static int LOOP_IN_THREAD
           
(package private)  int loopInThread
           
(package private) static int MAIN_THREAD_QUERY_LOOP
           
(package private) static int MAX_ID_VALUE
           
(package private) static int MAX_RESPONSE_TIME
           
(package private)  int maxIdValue
           
(package private)  int maxResponseTime
           
(package private) static boolean MONITOR_SPEED
           
(package private)  boolean monitorSpeed
           
(package private)  QueryGenerator queryGenerator
           
(package private)  int queryLoop
           
(package private)  boolean quit
           
(package private)  java.util.Random rand
           
(package private)  int requestCount
           
(package private)  int requestInterval
           
(package private)  long runtime
           
(package private) static int TIME_BETWEEN_REQUEST
           
(package private) static boolean USE_PREPARED_STATEMENT
           
(package private) static boolean USE_QUERY_GENERATOR
           
(package private) static boolean USE_TRANSACTION
           
(package private)  boolean usePreparedStatement
           
(package private)  boolean useQueryGenerator
           
(package private)  boolean useTransactions
           
 
Constructor Summary
RequestSender(java.sql.Connection con)
          Creates a new RequestSender object with standard settings
 
Method Summary
 long getAverage()
          Returns the average value.
 java.util.ArrayList getExceptions()
          Returns the exceptions value.
 QueryGenerator getQueryGenerator()
           
 int getRequestCount()
          Returns the requestCount value.
 long getRuntime()
          Returns the runtime value.
private  java.lang.String getSelectStatement(boolean preparedStatement, int id)
           
private  java.lang.String getUpdateStatement(boolean preparedStatement, int addressid, int id)
           
 boolean isQuit()
          Returns the quit value.
 void run()
           
 void setCommitIntervalMax(int commitIntervalMax)
          Sets the commitIntervalMax value.
 void setDoWriteEvery(int doWriteEvery)
          Sets the doWriteEvery value.
 void setLoopInThread(int loopInThread)
          Sets the loopInThread value.
 void setMaxIdValue(int maxIdValue)
          Sets the maxIdValue value.
 void setMaxResponseTime(int maxResponseTime)
          Sets the maxResponseTime value.
 void setMonitorSpeed(boolean monitorSpeed)
           
 void setQueryGenerator(QueryGenerator queryGenerator)
          Sets the queryGenerator value.
 void setQueryLoop(int queryLoop)
          Sets the queryLoop value.
 void setQuit(boolean quit)
          Sets the quit value.
 void setRand(java.util.Random rand)
          Sets the rand value.
 void setRequestInterval(int requestInterval)
          Sets the requestInterval value.
 void setUsePreparedStatement(boolean usePreparedStatement)
          Sets the usePreparedStatement value.
 void setUseQueryGenerator(boolean useQueryGenerator)
          Sets the useQueryGenerator value.
 void setUseTransactions(boolean useTransactions)
          Sets the useTransactions value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

quit

boolean quit

rand

java.util.Random rand

exceptions

java.util.ArrayList exceptions

con

java.sql.Connection con

runtime

long runtime

queryGenerator

QueryGenerator queryGenerator

loopInThread

int loopInThread

doWriteEvery

int doWriteEvery

queryLoop

int queryLoop

maxIdValue

int maxIdValue

maxResponseTime

int maxResponseTime

requestInterval

int requestInterval

useTransactions

boolean useTransactions

commitIntervalMax

int commitIntervalMax

usePreparedStatement

boolean usePreparedStatement

monitorSpeed

boolean monitorSpeed

requestCount

int requestCount

average

long average

useQueryGenerator

boolean useQueryGenerator

LOOP_IN_THREAD

static final int LOOP_IN_THREAD
See Also:
Constant Field Values

DO_WRITE_EVERY

static final int DO_WRITE_EVERY
See Also:
Constant Field Values

MAIN_THREAD_QUERY_LOOP

static final int MAIN_THREAD_QUERY_LOOP
See Also:
Constant Field Values

MAX_ID_VALUE

static final int MAX_ID_VALUE
See Also:
Constant Field Values

MAX_RESPONSE_TIME

static final int MAX_RESPONSE_TIME
See Also:
Constant Field Values

TIME_BETWEEN_REQUEST

static final int TIME_BETWEEN_REQUEST
See Also:
Constant Field Values

USE_TRANSACTION

static final boolean USE_TRANSACTION
See Also:
Constant Field Values

DO_COMMIT_RAND_NUMBER

static final int DO_COMMIT_RAND_NUMBER
See Also:
Constant Field Values

USE_PREPARED_STATEMENT

static final boolean USE_PREPARED_STATEMENT
See Also:
Constant Field Values

MONITOR_SPEED

static final boolean MONITOR_SPEED
See Also:
Constant Field Values

USE_QUERY_GENERATOR

static final boolean USE_QUERY_GENERATOR
See Also:
Constant Field Values
Constructor Detail

RequestSender

public RequestSender(java.sql.Connection con)
Creates a new RequestSender object with standard settings

Parameters:
con - the connection to the database
Method Detail

setMonitorSpeed

public void setMonitorSpeed(boolean monitorSpeed)
Parameters:
monitorSpeed - The monitorSpeed to set.

getSelectStatement

private java.lang.String getSelectStatement(boolean preparedStatement,
                                            int id)

getUpdateStatement

private java.lang.String getUpdateStatement(boolean preparedStatement,
                                            int addressid,
                                            int id)

getQueryGenerator

public QueryGenerator getQueryGenerator()
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

run

public void run()
Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

isQuit

public boolean isQuit()
Returns the quit value.

Returns:
Returns the quit.

setQuit

public void setQuit(boolean quit)
Sets the quit value.

Parameters:
quit - The quit to set.

getExceptions

public java.util.ArrayList getExceptions()
Returns the exceptions value.

Returns:
Returns the exceptions.

setCommitIntervalMax

public void setCommitIntervalMax(int commitIntervalMax)
Sets the commitIntervalMax value.

Parameters:
commitIntervalMax - The commitIntervalMax to set.

setDoWriteEvery

public void setDoWriteEvery(int doWriteEvery)
Sets the doWriteEvery value.

Parameters:
doWriteEvery - The doWriteEvery to set.

setLoopInThread

public void setLoopInThread(int loopInThread)
Sets the loopInThread value.

Parameters:
loopInThread - The loopInThread to set.

setMaxIdValue

public void setMaxIdValue(int maxIdValue)
Sets the maxIdValue value.

Parameters:
maxIdValue - The maxIdValue to set.

setMaxResponseTime

public void setMaxResponseTime(int maxResponseTime)
Sets the maxResponseTime value.

Parameters:
maxResponseTime - The maxResponseTime to set.

setQueryLoop

public void setQueryLoop(int queryLoop)
Sets the queryLoop value.

Parameters:
queryLoop - The queryLoop to set.

setRand

public void setRand(java.util.Random rand)
Sets the rand value.

Parameters:
rand - The rand to set.

setRequestInterval

public void setRequestInterval(int requestInterval)
Sets the requestInterval value.

Parameters:
requestInterval - The requestInterval to set.

setUseTransactions

public void setUseTransactions(boolean useTransactions)
Sets the useTransactions value.

Parameters:
useTransactions - The useTransactions to set.

getRuntime

public long getRuntime()
Returns the runtime value.

Returns:
Returns the runtime.

setUsePreparedStatement

public void setUsePreparedStatement(boolean usePreparedStatement)
Sets the usePreparedStatement value.

Parameters:
usePreparedStatement - The usePreparedStatement to set.

getAverage

public long getAverage()
Returns the average value.

Returns:
Returns the average.

getRequestCount

public int getRequestCount()
Returns the requestCount value.

Returns:
Returns the requestCount.

setUseQueryGenerator

public void setUseQueryGenerator(boolean useQueryGenerator)
Sets the useQueryGenerator value.

Parameters:
useQueryGenerator - The useQueryGenerator to set.

setQueryGenerator

public void setQueryGenerator(QueryGenerator queryGenerator)
Sets the queryGenerator value.

Parameters:
queryGenerator - The queryGenerator to set.


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.