org.objectweb.cjdbc.requestplayer
Class ClientThread

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.objectweb.cjdbc.requestplayer.ClientThread
All Implemented Interfaces:
java.lang.Runnable

public class ClientThread
extends java.lang.Thread

C-JDBC client emulator worker thread. Reads SQL requests in a file and forwards them to the cache. If the cache returns no reply, this class forwards the request to the database. Then it returns the reply and updates the cache if needed.

Version:
1.0
Author:
Emmanuel Cecchet , Julie Marguerite

Field Summary
private  Stats beginStats
          Number of transaction begin.
private  Stats closeStats
          Statistics about closing a connection
private  Stats commitStats
          Number of transaction commit.
private  java.sql.Connection conn
           
private  int connectionType
          Type of connection management: standard, fixed or pooling
private static boolean DEBUG
          Debug on standard output.
private  Stats deleteStats
          Number of delete requests.
private  ClientEmulator father
           
private  Stats getConnectionStats
          Statistics about get connection from driver
private  Stats getRequestStats
          Statistics about getting request from the log file
private  Stats insertStats
          Number of insert requests.
private  Stats rollbackStats
          Number of transaction rollback.
private  Stats selectStats
          Number of read requests.
private  int threadId
           
private  Stats unknownStats
          Number of unknown requests.
private  Stats updateStats
          Number of update requests.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ClientThread(int threadId, ClientEmulator father, int connectionType)
          Creates a new ClientThread instance.
 
Method Summary
private  void closeConnection()
          Closes the connection to the database.
private  void execReadRequest(java.lang.String req)
          Executes a select request.
private  void execWriteRequest(java.lang.String req)
          Executes a write request.
private  java.sql.Connection getConnection()
          Gets a new connection to the database.
 void run()
           
 
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

DEBUG

private static final boolean DEBUG
Debug on standard output.

See Also:
Constant Field Values

selectStats

private Stats selectStats
Number of read requests.


unknownStats

private Stats unknownStats
Number of unknown requests.


updateStats

private Stats updateStats
Number of update requests.


insertStats

private Stats insertStats
Number of insert requests.


deleteStats

private Stats deleteStats
Number of delete requests.


beginStats

private Stats beginStats
Number of transaction begin.


commitStats

private Stats commitStats
Number of transaction commit.


rollbackStats

private Stats rollbackStats
Number of transaction rollback.


getConnectionStats

private Stats getConnectionStats
Statistics about get connection from driver


closeStats

private Stats closeStats
Statistics about closing a connection


getRequestStats

private Stats getRequestStats
Statistics about getting request from the log file


conn

private java.sql.Connection conn

father

private ClientEmulator father

threadId

private int threadId

connectionType

private int connectionType
Type of connection management: standard, fixed or pooling

Constructor Detail

ClientThread

public ClientThread(int threadId,
                    ClientEmulator father,
                    int connectionType)
Creates a new ClientThread instance.

Parameters:
threadId - thread id
father - father client emulator
connectionType - connection type
Method Detail

run

public void run()
See Also:
Runnable.run()

execWriteRequest

private void execWriteRequest(java.lang.String req)
Executes a write request.

Parameters:
req - request to execute

execReadRequest

private void execReadRequest(java.lang.String req)
Executes a select request.

Parameters:
req - request to execute

closeConnection

private void closeConnection()
Closes the connection to the database.


getConnection

private java.sql.Connection getConnection()
Gets a new connection to the database.

Returns:
Connection


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