Solved

Not calling SetComplete in a contained MTS component?

Posted on 2000-02-17
5
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

688 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