public void begin ( int timeout ) throws NotSupportedException,
SystemException
{
TransactionImp tx = null;
CompositeTransaction ct = null;
ResumePreviousTransactionSubTxAwareParticipant resumeParticipant = null;
ct = ctm_.getCompositeTransaction();
if ( ct != null && ct.getProperty ( JTA_PROPERTY_NAME ) == null ) {
Configuration.logWarning ( "JTA: temporarily suspending incompatible transaction: " + ct.getTid() +
" (will be resumed after JTA transaction ends)" );
ct = ctm_.suspend();
resumeParticipant = new ResumePreviousTransactionSubTxAwareParticipant ( ct );
}
try {
ct = ctm_.createCompositeTransaction ( ( ( long ) timeout ) * 1000 );
if ( resumeParticipant != null ) ct.addSubTxAwareParticipant ( resumeParticipant );
if ( ct.isRoot () && getDefaultSerial () )
ct.getTransactionControl ().setSerial ();
ct.setProperty ( JTA_PROPERTY_NAME , "true" );
} catch ( SysException se ) {
String msg = "Error in begin()";
Configuration.logWarning( msg , se );
throw new ExtendedSystemException ( msg , se
.getErrors () );
}
// a new tx can not be in the map yet.
// next, we put it there.
tx = new TransactionImp ( ct, automaticResourceRegistration_ );
addToMap ( ct.getTid (), tx );
ct.addSubTxAwareParticipant ( this );
}