|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tppt.xopen.TwoPhaseController
TwoPhaseController class is the main class to perform the two-phase commit simulation environment.
Inner Class Summary | |
(package private) class |
TwoPhaseController.Worker
The Worker class. |
Field Summary | |
(package private) APInterface[] |
ap
|
private java.lang.String |
apClassDir
Directory path to load the ApplicationProgram |
(package private) AX |
ax
|
private ListItem |
dot
The ListItem to show the dot(.) to the log window. |
private java.lang.String |
dotStr
|
protected TwoPhaseLogger |
logger
The logger |
private int |
numOfAp
Number of ApplicationProgram the program expected to load |
protected javax.swing.Timer |
timer
The timer that control the transition of the worker. |
(package private) TMInterface |
tm
|
private java.lang.String |
tmClassPath
File path to load the TransactionManager |
(package private) TX |
tx
|
(package private) TwoPhaseController.Worker[] |
worker
The array of Worker. |
Constructor Summary | |
private |
TwoPhaseController()
Empty constructor. |
|
TwoPhaseController(java.lang.String tmPath,
java.lang.String apDir,
int num,
java.lang.String schemaFile)
The constructor. |
Method Summary | |
private void |
confirmRegistration()
Performs the first stage check. |
private void |
confirmResult()
Perform the Two-Phase Commit check Check whether user commit or abort the transaction correctly. |
private void |
forceCloseConnection()
Force all the ResourceManager to release its connection. |
private boolean |
loadClass()
Dynamically load the TransactionManager and ApplicationProgram(s) classes user provided |
static void |
main(java.lang.String[] args)
|
boolean |
twoPhaseDBInit(java.lang.String file)
Initialize the database. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.lang.String tmClassPath
private java.lang.String apClassDir
private int numOfAp
protected TwoPhaseLogger logger
protected javax.swing.Timer timer
TwoPhaseController.Worker[] worker
private ListItem dot
private java.lang.String dotStr
AX ax
TX tx
TMInterface tm
APInterface[] ap
Constructor Detail |
private TwoPhaseController()
public TwoPhaseController(java.lang.String tmPath, java.lang.String apDir, int num, java.lang.String schemaFile)
Below shows the status and what the timer process will behave regarding to each status : -1 : Something is wrong. Exception throws inside this worker. Terminates all the worker, close the connection and stop the timer. 1: If status of all workers are 1, it means they all finish the setup process before the two-phase commit, then timer will first confirm the result and then change their status to 2. 2: If worker's status =2, it will commit its ApplicationProgram so the two-phase commit starts. And worker set the status to 3. 3: If status of all workers are 3, it means two-phase commit is done. Timer will check the result, terminate all the workers and kill itself.
tmPath
- the file path of user's TransactionManager ClassapDir
- the directory path of user's ApplicationProgram class(es)num
- number of ApplicationProgramschemaFile
- the file path of user's Database initialization FiletwoPhaseDBInit(java.lang.String)
,
loadClass()
Method Detail |
private boolean loadClass()
java.net.URLClassLoader
private void forceCloseConnection()
ResourceManager.forceCloseConnection()
private void confirmRegistration()
ResourceManager.connectToRM(int, int, tppt.db.DBSetting)
,
ResourceManager.registerToTM()
private void confirmResult()
public boolean twoPhaseDBInit(java.lang.String file)
file
- database initialization fileDBHandler
,
DB2Handler
,
SybaseHandler
,
DBSetting
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |