[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

Not calling SetComplete in a contained MTS component?

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
barrett
Asked:
barrett
  • 2
  • 2
1 Solution
 
tchalkovCommented:
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
 
wqwCommented:
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
 
barrettAuthor Commented:
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
 
wqwCommented:
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
 
barrettAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now