Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
COM+ , use of SetComplete
Message
De
10/11/2004 11:46:06
 
 
À
10/11/2004 07:50:06
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00959728
Message ID:
00960055
Vues:
7
>> 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.
>
>COM+ is stateless, and it's always a mistake to try to make it any other way.

No. COM+ is not always stateless. It SHOULD be stateless, but it is not always that way.

>
>> However, you are correct that you'll only call SetComplete()
>> when you have totally finished using that instance of the component.
>
>I disagree: apart from ignoring SetComplete's function of notifying COM+ that a transaction can be committed, use of SetComplete allows COM+ to scale. The object isn't released until the application's idle shutdown
>timeout is reached. Each server call should make no assumptions about state, obtain a context reference at the start, and call SetComplete at the end (or SetAbort if needs be). That's how COM+ works best.

I think I said that. When you finish using an instance of a component, you call SetComplete(). If the next line of code instantiates the same object, there is no guarantee that you'll get the same instance.

>
>In a crude way - what if the user leaves your app open when going to lunch but then goes straight home feeling ill? Your server object will sit there until the app is closed when the user returns.

Yup.

>
>>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.
>
>Yes, if there are no further calls from the original client, or any other client. COM+ caches the object, though, for when it's called next.

Only for a specific period of time. COM+ then releases it if it hasn't been called.

However, if you're using Object Pooling, it will stay in memory. But, you can't use Object Pooling with VFP components as they only support apartment model threading.

>
>> 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?
>
>Yes, very much so. In my opinion.
>
>Regards
>
>Stuart
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform