|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.cjdbc.requestplayer.ClientEmulator
C-JDBC client emulator. Reads SQL requests in a file and forwards them to the controller.
Field Summary | |
private java.io.File |
configFile
Request player configuration file. |
private int |
connectionType
Type of connection management: standard, optimized or pooling. |
protected Stats |
deleteStats
Statistics concerning the DELETE requests. |
private java.util.Stack |
freeConnections
Stack of available connections (pool). |
private java.util.HashSet |
ignoredTids
|
protected Stats |
insertStats
Statistics concerning the INSERT requests. |
static int |
MAJOR_VERSION
Major version. |
private int |
maxRequests
Max number of requests. |
static int |
MINOR_VERSION
Minor version. |
private int |
nbRequests
Number of requests. |
private int |
poolSize
Connection pool size. |
private java.lang.String |
propPassword
Database password. |
private java.lang.String |
propUrl
Database URL. |
private java.lang.String |
propUsername
Database login. |
private RequestPlayerProperties |
requestPlayerProp
Access to the properties file. |
protected Stats |
selectStats
Statistics concerning the SELECT requests. |
protected java.io.BufferedReader |
sqlTrace
To read the SQL requests in the file. |
private java.util.Hashtable |
tidList
Transaction id list. |
private int |
timeout
Query timeout. |
private java.lang.Integer |
transactionId
Transaction id. |
protected Stats |
unknownStats
Statistics concerning the unknown requests. |
protected Stats |
updateStats
Statistics concerning the UPDATE requests. |
private static java.lang.Integer |
ZERO
Zero value. |
Constructor Summary | |
ClientEmulator(java.lang.String configFile)
Creates a new ClientEmulator instance. |
Method Summary | |
void |
closeConnection(java.sql.Connection connection)
Closes a given connection. |
private static org.apache.commons.cli.Options |
createOptions()
Creates Options object that contains all available options
that can be used launching C-JDBC request player. |
void |
finalizeConnections()
Releases all the connections to the database. |
java.sql.Connection |
getConnection()
Gets a new connection from the driver. |
java.sql.Connection |
getConnectionFromPool()
Gets a connection from the pool (round-robin). |
Stats |
getDeleteStats()
Returns the DELETE requests statictics. |
Stats |
getInsertStats()
Returns the INSERT requests statictics. |
Stats |
getSelectStats()
Returns the SELECT requests statictics. |
int |
getTimeout()
Returns the query timeout. |
Stats |
getUnknownStats()
Returns the unknown requests statictics. |
Stats |
getUpdateStats()
Returns the UPDATE requests statictics |
void |
ignoreTid(int tid)
Ignores all requests belonging to a specific transaction id. |
void |
initializeConnections()
Initializes the pool of connections to the database. |
static void |
main(java.lang.String[] args)
Main method. |
java.lang.String |
parallelGetNextSQLRequest(int tid)
Gets the next SQL request from the trace file. |
private static void |
printUsage(org.apache.commons.cli.Options options)
Displays usage message. |
private java.lang.String |
readRequest()
Must be called from a synchronized statement. |
void |
releaseConnectionToPool(java.sql.Connection connection)
Releases a connection to the pool. |
java.lang.String |
sequentialGetNextSQLRequest(int tid)
Gets the next SQL request from the trace file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MAJOR_VERSION
public static final int MINOR_VERSION
private static final java.lang.Integer ZERO
private java.io.File configFile
private java.lang.String propUrl
private java.lang.String propUsername
private java.lang.String propPassword
private RequestPlayerProperties requestPlayerProp
protected java.io.BufferedReader sqlTrace
protected Stats selectStats
SELECT
requests.
protected Stats unknownStats
protected Stats updateStats
UPDATE
requests.
protected Stats insertStats
INSERT
requests.
protected Stats deleteStats
DELETE
requests.
private int nbRequests
private int maxRequests
private java.util.Hashtable tidList
private java.util.HashSet ignoredTids
private int timeout
private int connectionType
private java.util.Stack freeConnections
private int poolSize
private java.lang.Integer transactionId
Constructor Detail |
public ClientEmulator(java.lang.String configFile)
ClientEmulator
instance. The program is stopped
on any error reading the configuration files.
configFile
- configuration file to used.Method Detail |
public java.sql.Connection getConnection()
public void initializeConnections() throws java.sql.SQLException
java.sql.SQLException
- if an error occurspublic void closeConnection(java.sql.Connection connection)
connection
- connection to closepublic java.sql.Connection getConnectionFromPool()
Connection
instance or null
if no
connection is availablepublic void releaseConnectionToPool(java.sql.Connection connection)
connection
- the connection to releasepublic void finalizeConnections() throws java.sql.SQLException
java.sql.SQLException
- if an error occurspublic java.lang.String parallelGetNextSQLRequest(int tid)
tid
- transaction id
String
containing the SQL request or
null
if no more requests are available (end of file or
maximum number of requests reached)public void ignoreTid(int tid)
tid
- the tid to ignorepublic java.lang.String sequentialGetNextSQLRequest(int tid)
tid
- transaction id
String
containing the SQL request or
null
if no more requests are available (end of file or
maximum number of requests reached)private java.lang.String readRequest()
public Stats getDeleteStats()
DELETE
requests statictics.
Stats
instance.public Stats getInsertStats()
INSERT
requests statictics.
Stats
instance.public Stats getSelectStats()
SELECT
requests statictics.
Stats
instance.public Stats getUnknownStats()
Stats
instance.public Stats getUpdateStats()
UPDATE
requests statictics. *
Stats
instance.public int getTimeout()
int
value.public static void main(java.lang.String[] args)
-h
or --help
<port>
:
displays usage informations.-v
or --version
: displays version
informations.-f
or --file
: allows to use a given
configuration file instead of the default file.
args
- command line arguments (see above)private static org.apache.commons.cli.Options createOptions()
Options
object that contains all available options
that can be used launching C-JDBC request player.
Options
instanceprivate static void printUsage(org.apache.commons.cli.Options options)
options
- available command line options
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |