// duplicate prepares can happen for siblings in serial subtxs!!!
// in that case, the second prepare just returns READONLY
if ( state_.equals ( TxState.IN_DOUBT ) )
return Participant.READ_ONLY;
else if ( !state_.equals ( TxState.LOCALLY_DONE ) )
throw new SysException ( "Wrong state for prepare: " + state_ );
try {
// refresh xaresource for MQSeries: seems to close XAResource after
// suspend???
testOrRefreshXAResourceFor2PC ();
printMsg ( "About to call prepare on XAResource instance: "
+ xaresource_, Console.DEBUG );
ret = xaresource_.prepare ( xid_ );
} catch ( XAException xaerr ) {
String msg = interpretErrorCode ( resourcename_ , "prepare" , xid_ , xaerr.errorCode );
Configuration.logDebug ( msg , xaerr );
if ( (XAException.XA_RBBASE <= xaerr.errorCode)
&& (xaerr.errorCode <= XAException.XA_RBEND) ) {
throw new RollbackException ( msg );
} else {
errors.push ( xaerr );
throw new SysException ( msg , errors );
}
}
state_ = TxState.IN_DOUBT;
if ( ret == XAResource.XA_RDONLY ) {
printMsg ( "XAResource.prepare ( " + xidToHexString (xid_)