-
Questions about MTS
I have a few questions about MTS.
1. When calling an MTS component, can you use both New or CreateObject?
Since the MTS component will be hosted on another machine anyway, can you
use both New and CreateObject? Whatever one you can use, how do you call
the component (example: Dim objEmployee as New clsEmployee, or Set objEmployee=CreateObject("clsEmployee.Salary"
"computername")? Are both ways acceptable?
2. After an instance of the MTS component/class is created, can a transaction
be carried out in only one class by calling SetComplete. Do you have to call
a second class in order to create a transaction? For example, you have the
client, and class A. The client calls class A, and at the end of the method
in class A, SetComplete is called? I tried to do this, and when I looked
at the transaction monitor, nothing happened. In another example, I have
the client and class A and B. The client calls calss A, which in turn calls
class B. When I call SetComplete in both Classs B and A (both objects voted
for a good transaction), than the transaction monitor worked. Is this the
only way to create a transaction? Must you have one class call another class?
3. Should you call SetComplete after each method, wheather or not you are
using one method in one class or multiple methods in multiple classes? For
example, if the client calls class A, and you call SetComplete at the end
of the method, and you are not involved in a transaction (the transaction
monitor does not work), is there a benefit in making the SetComplete call?
Does it destroy the object and leave the Context Wrapper, or does this happed
automatically when the method completes its call?
-
Re: Questions about MTS
"Bob Bennett" <bbennett1002@hotmail.com> wrote in message
news:3aba2047$1@news.devx.com...
>
> I have a few questions about MTS.
>
> 1. When calling an MTS component, can you use both New or CreateObject?
> Since the MTS component will be hosted on another machine anyway, can you
> use both New and CreateObject? Whatever one you can use, how do you call
> the component (example: Dim objEmployee as New clsEmployee, or Set
objEmployee=CreateObject("clsEmployee.Salary"
> "computername")? Are both ways acceptable?
>
Yes, but you can only use New if you exported client setup package from MTS.
> 2. After an instance of the MTS component/class is created, can a
transaction
> be carried out in only one class by calling SetComplete. Do you have to
call
> a second class in order to create a transaction? For example, you have the
> client, and class A. The client calls class A, and at the end of the
method
> in class A, SetComplete is called? I tried to do this, and when I looked
> at the transaction monitor, nothing happened. In another example, I have
> the client and class A and B. The client calls calss A, which in turn
calls
> class B. When I call SetComplete in both Classs B and A (both objects
voted
> for a good transaction), than the transaction monitor worked. Is this the
> only way to create a transaction? Must you have one class call another
class?
>
Transaction can be carried out in any class and can span as many classes as
you want. If you want class A always participate in transaction make sure
that its transaction mode is set to RequiresTransaction or
RequiresNewTransaction.
> 3. Should you call SetComplete after each method, wheather or not you are
> using one method in one class or multiple methods in multiple classes?
For
> example, if the client calls class A, and you call SetComplete at the end
> of the method, and you are not involved in a transaction (the transaction
> monitor does not work), is there a benefit in making the SetComplete call?
> Does it destroy the object and leave the Context Wrapper, or does this
happed
> automatically when the method completes its call?
Calling SetComplete in every method is a good idea, it let MTS know that
you're finished.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks