Re: DisableCommit vs SetAbort

"Knebels, Francis" <[email protected]> Wed, 17 Jul 2002 09:35:25 -0400
Newsgroups gmane.comp.windows.devel.vbcom
Message-ID <[email protected]>
DisableCommit is more like I'm not ready to be commited yet. i.e. you are
doing something to an object and it is in an inconsistent state, but at some
point you still want to commit it.  This is also known as the 'done bit'
because it should be set when all the work is done.

SetAbort means a failure has occurred and everything needs to be rolled back
in the transaction.  this is the 'happy bit.'  and declares that everything
has worked correctly.

The only time a transaction in COM+ is commited is when then the root object
returns.  Upon return is examines all the happy bits of the secondary
objects if one isn't happy is rolls back that transactions.  So calling
DisableCommit would just say to the root object that a secondary object is
in an intermediate state and not ready to be commit/rolled back.  You want
to set SetAbort in the secondary objects.


[pseduo code]

Sub myMethod
        'setAbort coming into the method so we won't get committed in the
event of an error.
        GetObjectContext().setAbort

        'write some stuff to a database without an error

        'setCommit on the way out to say everything is peachy.
        GetObjectContext().setCommit

End Sub

I also thought in VB that these 2 bits could not be set independently but I
could be wrong.  The bits live in ITransactionContext which I don't think is
available in the ObjectContext returned from GetObjectContext.


Francis X. Knebels
Merck Vaccine Division

-----Original Message-----
From: James Brophy (CharcolOnline) [mailto:[email protected]]
Sent: Wednesday, July 17, 2002 9:08 AM
To: [email protected]
Subject: [VBCOM] DisableCommit vs SetAbort


Can anyone tell me what the practical difference between the Root object in
a transaction calling DisableCommit and SetAbort on failure / an error
raised by one or more Secondary objects?

Basically, design-wise, I would like to have all Secondary objects call
DisableCommit on failure / error; and all Root objects call SetAbort on
handling such a failure / error. Can anyone supply a reason not to?


Many thanks,

James Brophy

You can read messages from the VBCOM archive, unsubscribe from VBCOM, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message.  If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.

==============================================================================

You can read messages from the VBCOM archive, unsubscribe from VBCOM, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.