Solved

Not calling SetComplete in a contained MTS component?

Posted on 2000-02-17
5
221 Views
Last Modified: 2006-11-17
I'm having a design discussion with fellow engineers, and we need a judgment call: We have an MTS component that requires a transaction, and this component instantiates a second MTS component (i.e., composition / containment) through the object context. If the second component never calls SetComplete or SetAbort, but the root component does, will the second component and its resources be freed correctly?

I'd like to see the second, contained component call SetAbort and SetComplete appropriately, but other engineers think this is unnecessary, since all it does is open a connection, call a stored proc, close the connection and return a disconnected recordset.

Which is the better design decision?
0
Comment
Question by:barrett
  • 2
  • 2
5 Comments
 
LVL 7

Expert Comment

by:tchalkov
ID: 2533989
Here is what is said in the documentation of MTS:

"If an object doesn't need to maintain its state after it returns from a method call, it should call SetComplete so that it can be automatically deactivated as soon as it returns and its resources can be reclaimed."
0
 
LVL 4

Accepted Solution

by:
wqw earned 200 total points
ID: 2534200
Definately you'll need to call SetComplete/SetAbort.

If your second component is contained completely you can safely omit SetComplete/SetAbort and still have transactions. The problem is that this component will NOT be deactivated after method calls.

You can monitor this behaviour on MTS Explorer Components view. Your component will have N object of which N are activated. The moment you implement SetComplete/SetAbort scheme you get N Objects / 0 Activated.

HTH

</wqw>
0
 

Author Comment

by:barrett
ID: 2538473
MS tells us that the contained object *will* be deactivated. Let me take a few days to test -- our components are all disassembled right now.
0
 
LVL 4

Expert Comment

by:wqw
ID: 2541438
you are obviously using C++ for your components :-))

well, my experience is with VB components and we can't contain nor aggregate in COM sense. we are just instantiating trans components and then call a few methods...

</wqw>
0
 

Author Comment

by:barrett
ID: 2546651
You're right about C++...

MS just sent me this:

Additional information from another engineer:

The short answer is yes the second component will be released properly
although you still need to close and release your resources (i.e.
connections, etc.)

The longer answer is that you should still call SetComplete/SetAbort in the
second component.  All your components, no matter what their purpose should
call one of these two to indicate to the runtime that their state and that
they are done with their work.  This ensures proper behavior in the event
that one day this component becomes a root of a transaction.  It also
expedites the release process.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now