* @throws BrokerException
*/
public TransactionState getTransactionState( Connection conn,
TransactionUID txnUID ) throws BrokerException {
TransactionState txnState = null;
long id = txnUID.longValue();
boolean myConn = false;
PreparedStatement pstmt = null;
ResultSet rs = null;
Exception myex = null;
try {
// Get a connection
if ( conn == null ) {
conn = DBManager.getDBManager().getConnection( true );
myConn = true;
}
pstmt = conn.prepareStatement( selectTxnStateSQL );
pstmt.setLong( 1, id );
rs = pstmt.executeQuery();
if ( rs.next() ) {
try {
int state = rs.getInt( 1 );
txnState = (TransactionState)Util.readObject( rs, 2 );
// update state in TransactionState object
txnState.setState( state );
} catch ( IOException e ) {
// fail to parse TransactionState object; just log it
logger.logStack( Logger.ERROR,
BrokerResources.X_PARSE_TRANSACTION_FAILED, e );
}