|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--tppt.util.Terminal
Terminal is a thread to simulate a terminal that run the a group of transaction session user define in the Transaction Script File.
java.lang.Thread.
Field Summary | |
private java.util.Vector |
argumentFiles
array of OpenedFiles, opened non-terminal key argument files |
(package private) java.sql.Connection |
connection
|
private GlobalData |
global
|
(package private) int |
numOfDeadlocks
This variable is used to store the number of deadlocks occurs in this Terminal including the retry times. |
private int |
numOfRetry
|
(package private) int |
ONE_SECOND
|
(package private) boolean |
script_cycle
JY2001 for v1.4 JY changes the code to make it only execute the script file once. |
private java.lang.String |
scriptFileName
|
private java.util.Vector |
sessKeysVaules
Array of session keys. |
private boolean |
stop
|
private int |
terminalNum
Terminal number to identify this terminal. |
private java.util.Vector |
termKeysValues
Array of TermKeyValues instance. |
Fields inherited from class java.lang.Thread |
contextClassLoader, daemon, eetop, group, inheritableThreadLocals, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadLocals, threadQ |
Constructor Summary | |
(package private) |
Terminal(int i)
|
Method Summary | |
(package private) void |
closeArgFiles()
Close the opened argument files stored in the OpenedFiles Vector. |
private void |
countDeadlocks()
|
(package private) boolean |
dbConnect(java.lang.String user,
java.lang.String passwd)
Create the connection to the database. |
(package private) Transaction |
getTrans(java.lang.String procName)
Get the transaction instance from the line of Transaction Script File. |
(package private) boolean |
openArgFiles()
This method is used to seperate terminal key, session key and neither, and open or assign the argument file to each key. |
void |
run()
Start to run the transaction on this terminal. |
(package private) int |
runTransaction(java.lang.String procName)
prepares the and runs the transaction with name- procName .
|
(package private) java.lang.String |
selectArgValues(java.lang.String arg)
retrieve a value for non-sesskey (terminal key or neither)argument. |
(package private) boolean |
selectSessKeyValues()
select one value for each session-key argument and store them to the Vector- sessKeysVaules . |
(package private) boolean |
selectTermKeyValues()
create a TermKeyValue class for each terminal key and read its values from each corresponding argument file. |
(package private) void |
showError(java.lang.String errorMsg)
|
void |
stopTerm()
Set the stop flag to true to indicate this terminal has been stopped. |
Methods inherited from class java.lang.Thread |
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
final int ONE_SECOND
java.sql.Connection connection
int numOfDeadlocks
private int terminalNum
private int numOfRetry
boolean script_cycle
private boolean stop
private java.lang.String scriptFileName
private java.util.Vector argumentFiles
private java.util.Vector sessKeysVaules
private java.util.Vector termKeysValues
private GlobalData global
Constructor Detail |
Terminal(int i)
Method Detail |
void showError(java.lang.String errorMsg)
boolean dbConnect(java.lang.String user, java.lang.String passwd)
user
- the user name to login the database.passd
- the password to login the databaseTransaction getTrans(java.lang.String procName)
procName
- the transaction procedure read from Transaction Script File.GlobalData.transactions
,
Transaction.copy()
boolean selectTermKeyValues()
TermKeyValues
,
GlobalData.termKeys
boolean openArgFiles()
TermKeyValues
class to store the keyword
and the values. All the TermKeyValues instances are stored in the
Vector- termKeysValues
.
The non-terminal key -session key and neither, uses
OpenedFiles
class to store the filename and its arguemnt
file handler. All the OpenedFiles
instances are stored in
the Vector - argumentFiles
.selectTermKeyValues()
,
OpenedFiles
,
getTrans(String)
void closeArgFiles()
OpenedFiles.fileStream
boolean selectSessKeyValues()
sessKeysVaules
.java.lang.String selectArgValues(java.lang.String arg)
arg
- the name of argument to be retrieved.int runTransaction(java.lang.String procName)
procName
.
If the return from transaction is deadlock (-5), the program
will retry the number of numOfRetry
times.
Each retry starts 10 milliseconds after the previous transaction ends.getTrans(String)
,
Transaction.execTransaction()
public void run()
2. Due to the errors in the students' procedure. If any this kind of error occurs, the program will report this error to user and then whole experiment terminates.
3.Due to other errors. The same with 2.
run
in class java.lang.Thread
openArgFiles()
,
selectSessKeyValues()
,
runTransaction(String)
private void countDeadlocks()
public void stopTerm()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |