Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COM+ , use of SetComplete
Message
From
09/11/2004 18:51:12
 
 
To
09/11/2004 15:45:34
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 8 SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00959728
Message ID:
00959808
Views:
6
You probably won't like the answer...it depends. One of the great things about COM+ is that it scales really well. It gets that from reusing components. If your app holds onto the component for too long, then you lose some of that scalability. Where the threshold is at depends on your configuration (server memory, actual length of instantiation, number of users connecting to your component, etc). This tells me that you want to keep the component instantiated for as little time as possible.

However, the flip side is that the most expensive thing is instantiating the component in the first place. This means that if you continually instantiate and release a component, you'll take a performance hit.

So...you'll have to do some testing for you particular situation. Is it better to instantiate the component, save the values someplace, then release it. Then instiate it again, read the values, etc... or is it better to instantiate the component and keep using the same one.

However, you are correct that you'll only call SetComplete() when you have totally finished using that instance of the component.


>Question regarding use of SetComplete() in the context of COM+ server components.
>
>Craig's example from an article:
>
>
>	DEFINE CLASS Math AS SESSION OLEPUBLIC
>	  FUNCTION Multiply(tnNum1, tnNum2)
>	    LOCAL lnResult, loMtx, loContext
>
>	    * Create a reference to the MTS object
>	    loMtx = CREATEOBJECT(“MTXAS.APPSERVER.1”)
>
>	    * Create a reference to the Context object
>	    loContext = loMtx.GetObjectContext()
>	    lnResult = tnNum1 * tnNum2
>
>	    * Commit the transaction if there is one
>            * and tell MTS that we’re done using the component
>	    loContext.SetComplete()
>	    RETURN lnResult
>	  ENDFUNC
>	ENDDEFINE
>
>
>
>My reading tells me that the call to SetComplete() tells the component the client is finished with it, and it may end up cleared from server memory.
>
>I have a server-based component designed to perform some app-specific searches, which is called from the client form. If I want to have the same client use the component for multiple calls to these search methods over a long data entry session, should SetComplete() be used at the conclusion of these methods like that?
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform