Solved

MTS and Global MultiUse

Posted on 2001-08-12
4
385 Views
Last Modified: 2006-11-17
I have a nice errorhandler component which manages the error call stack. ie. When an error occurs, all error handlers use this component to return a nice new error description which is passed on thru the stack.

I'd like to make the component GlobalMultiUse so developers don't have to worry (or forget) about instantiating this component.

If I have a component designed to run under MTS, can I safely reference my new globalmultiuse error component.  

I have tried this and get a windows error when the MTS component times out.

Are there any tricks to this..?

(Sorry about the points, its all I have!!!)




0
Comment
Question by:misterben
  • 2
4 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 6378938
MTS takes care of creating and eliminating the component whenever it feels like. For example when the MTS machine runs out of memory, or when it hasn't been used for some time. That is the amin difference if you are using MTS, without MTS the component will run in-process and thus won't be destroyed until you request it to be destroyed.

You can try checking out the Activation tab in the properties of the components in MTS (I am using component services from windows 2000 so it might be named differently for you...)

regards,
CJ
0
 
LVL 6

Accepted Solution

by:
anthony_glenwright earned 75 total points
ID: 6379456
I had a global multiuse function (an error handler, just like you), and when we introduced MTS support, I just couldn't get it to work...

Eventually, I found this article, http://support.microsoft.com/support/kb/articles/Q241/8/96.ASP which contains "Do not use the GlobalMultiUse Instancing property for a class when you intend to use the ActiveX component under MTS or COM+. The interface for the GlobalMultiUse object is cached in a per thread-based table and is not freed until the thread terminates. As a result, if a call comes in with a different context (although on the same thread), it fails with RPC_E_WRONG_THREAD. To use components in MTS and COM+, you should design your classes in such a way that the objects are stateless. "
0
 

Author Comment

by:misterben
ID: 6379471
Thanks Anthony for the quick response.

0
 
LVL 6

Expert Comment

by:anthony_glenwright
ID: 6379482
No problem.  Good luck.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

808 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