Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COM+ , use of SetComplete
Message
From
10/11/2004 07:50:06
 
 
To
09/11/2004 18:51:12
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:
00959926
Views:
4
> 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.

> 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.

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.

>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.

> 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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform