|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tppt.xopen.ApplicationProgram
This class implements the ApplicatioProgram in the two-phase commit protocol.
APInterface
Field Summary | |
private TwoPhaseLogger |
logger
The logger |
private int |
tid
Transaction id |
private TMInterface |
tm
Transaction Manager |
Constructor Summary | |
ApplicationProgram()
The Constructor. |
Method Summary | |
boolean |
beginTransaction()
Application call the tx_begin() to obtains the transaction id from TM when this method is called. |
void |
closeTransaction()
Application calls the tx_close() to tell TransactionManager that this transaction has been done. |
void |
commitTransaction()
Application call the tx_commit() to commit the transaction. |
int |
getTransactionId()
Obtains the transaction id |
void |
setTransactionManager(TMInterface obj)
Set up the TransactionManager instance. |
boolean |
setupSubTransaction()
Initiate and define the sub-transaction(s) under this method. |
private boolean |
workRequest(int subId,
java.lang.String dbName,
java.lang.String dbuser,
java.lang.String dbpassd,
java.lang.String driver,
java.lang.String url,
java.lang.String proxy,
java.lang.String sqlStr)
This method is private method used to set up the JDBC parameters for the specific sub-transaction. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private int tid
private TMInterface tm
private TwoPhaseLogger logger
Constructor Detail |
public ApplicationProgram()
Method Detail |
public void setTransactionManager(TMInterface obj)
TwoPhaseController
when the user's TransactionManager is loaded.setTransactionManager
in interface APInterface
obj
- TMInterface objectTMInterface
public int getTransactionId()
getTransactionId
in interface APInterface
public boolean beginTransaction()
beginTransaction
in interface APInterface
TransactionManager.tx_begin()
public void closeTransaction()
closeTransaction
in interface APInterface
TransactionManager.tx_close(int)
public void commitTransaction()
commitTransaction
in interface APInterface
private boolean workRequest(int subId, java.lang.String dbName, java.lang.String dbuser, java.lang.String dbpassd, java.lang.String driver, java.lang.String url, java.lang.String proxy, java.lang.String sqlStr)
(1) Create the DBSetting objects that stored the JDBC setting for this sub-transaction. (2) Connect to Resource Manager using the JDBC setting from (1) (3) Ask the ResourceManager to register to TM (4) Start the this sub-transaction (5) Execute this sub-transaction.
subId
- the id for this subtransaction. It should be unique number for this application.dbName
- The name of DBMS. "DB2" or "SYBASE"dbuser
- The DB login name for the specific dbNamedbpassd
- The DB password for the specific dbNamedriver
- The JDBC driver for the specific dbNameurl
- The JDBC url for the specific dbNameproxy
- The proxy server if needed. Sybase needs proxy if connected from home.sqlStr
- The SQL command.public boolean setupSubTransaction()
setupSubTransaction
in interface APInterface
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |