|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tppt.xopen.TransactionManager
This class implements the simple version of Transaction Manager in the two-phase commit protocol.
TMInterface
Field Summary | |
private TwoPhaseLogger |
logger
The logger |
private static int |
tid
This variable stored the global transaction sequence. |
private static TMInterface |
tm
The Transaction Manager instance. |
Fields inherited from interface tppt.xopen.TMInterface |
runningTrans |
Constructor Summary | |
TransactionManager()
The constructor |
Method Summary | |
boolean |
ax_reg(int tid,
ResourceManager rm)
Register the ResourceManager for specified transaction. |
private static TMInterface |
create()
Create the TransactionManager instance if it has not been created. |
java.util.HashMap |
getRunningTransaction()
Return all the registered transactions. |
static TMInterface |
getTMInstance()
Get the TransactionManager instance. |
int |
tx_begin()
Application Program should call this method in order to obtain a global traansaction Id. |
boolean |
tx_close(int tid)
Application Program should call this method to close the global trnsaction. |
boolean |
tx_commit(int tid)
Application Program should call this method when it is ready to commit. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static TMInterface tm
private TwoPhaseLogger logger
private static int tid
Constructor Detail |
public TransactionManager()
Method Detail |
private static TMInterface create()
tm
to store the instance.
If tm is null, then create a new TransactionManager, return existing
tm
othereise.public static TMInterface getTMInstance()
TMInterface
public java.util.HashMap getRunningTransaction()
getRunningTransaction
in interface TMInterface
public int tx_begin()
TransactionRecord
for this new transaction and store it inside the runningTrans
.
This method is synchronized since more than
one Application Program might be run at the same time.tx_begin
in interface TX
public boolean tx_commit(int tid)
1. Phase one: Call xa_prepare() on all the registered RMs(cohorts) for the specified transaction. 2. Phase two: All commit or all abort depends on the response from the cohorts. Call xa_commit() to commit the transaction for some RM. Call xa_rollback() to abort the transaction for some RM. 3. Call the xa_close to close the connection & release the lock.
tx_commit
in interface TX
tid
- the id of transaction that want to commit.public boolean tx_close(int tid)
runningTrans
HashMap.tx_close
in interface TX
tid
- the global transaction idpublic boolean ax_reg(int tid, ResourceManager rm)
ax_reg
in interface AX
tid:
- global transaction idrid:
- resource manager id
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |