|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tppt.xopen.ResourceManager
ResourceManager
acts as proxy for the DBMS.
For each connection to the DBMS, we create an instance of ResourceManager to
handle the database activities. It implements the XA interface used to
interact with Transaction Mangaer.
XA
,
AX
,
TwoPhaseLogger
,
DBManager
,
DBSetting
Field Summary | |
private static java.util.ArrayList |
abortList
The abortList stored a list of should-be-aborting ResourceManager object. |
protected static AX |
ax
The AX object. |
protected DBManager |
db
This object is responsbile to interface with the DBMS. |
private TwoPhaseLogger |
logger
The log object. |
private java.util.Random |
random
The Random object using the time as the seed. |
protected int |
rid
ResouceManager id |
protected DBSetting |
setting
Database Setting object used to stored the JDBC setting parameters. |
private int |
status
store the random generated status for this RM. |
protected int |
tid
Global Transaction Id |
private static java.util.ArrayList |
trace
The trace list stores a list of created ResourceManager object. |
Constructor Summary | |
ResourceManager(int tid,
int rid,
DBSetting s)
The constructor. |
Method Summary | |
static ResourceManager |
connectToRM(int tid,
int rid,
DBSetting s)
This method has to be called by ApplicationProgram when setting up its subtransaction. |
boolean |
equals(java.lang.Object o)
Overwrite the equals method so that 2 RMs are the same iff both their tid and rid are the same. |
boolean |
executeTransaction(java.lang.String sql)
This method has to be called by user's ApplicationProgram. |
void |
forceCloseConnection()
Force this resource manager to release the connection and db lock. |
(package private) static java.util.ArrayList |
getAbortList()
Obtain the abort list. |
int |
getRMId()
Get the resource manager id |
(package private) int |
getStatus()
Get the status of this resource manager. |
(package private) static java.util.ArrayList |
getTraceList()
Obtain the trace list. |
int |
getTransactionId()
Return the transaction id that this resource manager belong to. |
boolean |
registerToTM()
This method must be called by the ApplicationProgram so that it will register itself to the Transaction Manager. |
private boolean |
setupConnection()
Create the DBManager object if it has not been created.
|
static void |
setXA(AX a)
Set up the AX. |
boolean |
startTransaction()
This method has to be called by user's Application Program so that the resource manager could start setup the connection and then start the local transaction to the underlining DBMS. |
boolean |
xa_close()
XA implementation. |
boolean |
xa_commit()
XA implementation. |
int |
xa_prepare()
The XA implementation. |
boolean |
xa_rollback()
XA implementation. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected int rid
protected int tid
private TwoPhaseLogger logger
protected DBSetting setting
DBSetting
protected static AX ax
protected DBManager db
private java.util.Random random
private int status
private static java.util.ArrayList trace
private static java.util.ArrayList abortList
Constructor Detail |
public ResourceManager(int tid, int rid, DBSetting s)
tid
- transaction id.rid
- resource manager ids
- DBSetting objectMethod Detail |
public static void setXA(AX a)
a
- The AX objectstatic java.util.ArrayList getAbortList()
static java.util.ArrayList getTraceList()
public static ResourceManager connectToRM(int tid, int rid, DBSetting s)
tid
- the transaction Idrid
- this resource manager ids
- JDBC settingpublic int getRMId()
public int getTransactionId()
public boolean registerToTM()
AX.ax_reg(int, tppt.xopen.ResourceManager)
private boolean setupConnection()
DBManager
object if it has not been created.
And then connect to the specified DBMS. This method is called
by startTransaction method.DBManager
,
DBSetting
,
DBManager.createConnection(DBSetting)
public boolean startTransaction()
setupConnection()
,
DBManager.startTransaction()
public boolean executeTransaction(java.lang.String sql)
sql
- the SQL commandpublic int xa_prepare() throws PreparedTimeoutException
xa_prepare
in interface XA
PreparedTimeoutException
- if this resource manager is timeout.public boolean xa_rollback()
xa_rollback
in interface XA
DBManager.rollbackTransaction()
public boolean xa_close()
xa_close
in interface XA
DBManager.closeTransaction()
public boolean xa_commit()
xa_commit
in interface XA
DBManager.commitTransaction()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the ResourceManaher objectint getStatus()
Message.RM_STATUS_WAIT: If no action yet Message.RM_STATUS_COMMIT: commited Message.RM_STATUS_ABORT: abort
public void forceCloseConnection()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |