Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Component Services / August 2005

Tip: Looking for answers? Try searching our database.

JITA And Object Pooling

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ram - 27 Jul 2005 13:33 GMT
Hey,
I have a ServicedComponent that is configured to support Object Pooling
and Just In Time Activation.
I have the following code that uses my ServicedComponent:

Public Sub Test()
dim objSC as MyServicedComponent
objSC = New MyServicedComponent
objSC.Method()
End Sub

Oridnary I would call DisposeObject to release the object, but since
this object is JITA, should I call DisposeObject or not?
Thanks ahead

--Ram
Tomas Restrepo (MVP) - 27 Jul 2005 23:48 GMT
Ram,

> I have a ServicedComponent that is configured to support Object Pooling
> and Just In Time Activation.
[quoted text clipped - 8 lines]
> Oridnary I would call DisposeObject to release the object, but since
> this object is JITA, should I call DisposeObject or not?

No, you shouldn't. In fact, if the object has deactivated itself (through
any of the possible ways it can do this) and you call Dispose(), you'll
force a new activation which will just attend the Dispose() call!

(yes, I find this totally unintuitive as well!)

Signature

Tomas Restrepo
tomasr@mvps.org
http://www.winterdom.com/

Ram - 28 Jul 2005 07:58 GMT
Tomas hey thanks for replying,
The thing is, I defined my ServicedComponent as
JustInTimeActivation(true)
and at every method I need, I defiend:
ContextUtil.DeactivateOnReturn=true
And defined the min pool size to 5 and max to 10.
And all is well - when I look at the component services manager (MMC) I
see that after each call the number of objects activated returns to 0
all the time, but the number of object just keeps on increasing.
Doesnt the JITA returns my objects to the pool after each deactivation?
Thanks again

--Ram
Tomas Restrepo (MVP) - 29 Jul 2005 02:35 GMT
Ram,

> The thing is, I defined my ServicedComponent as
> JustInTimeActivation(true)
[quoted text clipped - 5 lines]
> all the time, but the number of object just keeps on increasing.
> Doesnt the JITA returns my objects to the pool after each deactivation?

Yes, it does. If it didn't, you'd deadlock when the pool reached the maximum
size.

What you see is that the "Objects" statistic in the component services
manager doesn't actually mean number of objects, but rather the existing
number of connections; that is, the number of client side stubs connected to
the application, whether they are attached to an active object or not. What
you see is that you're probably ending up creating stubs even if they are
not needed, and those will drop after a gc (that happens because you're not
reusing the client side references to the objects bur rather discarding
them).

Signature

Tomas Restrepo
tomasr@mvps.org
http://www.winterdom.com/

Ram - 30 Jul 2005 23:29 GMT
Does the number of connections affects the performance of my serviced
component?
If not, does is affect it at all?
And about not reusing the client side references to the object - I have
an ASP.Net web app that uses my JITA enabled serviced component on each
postback to the server.
How can I reuse the connection? hold a static instance to the object?
or am I missing the point?
Thanks again for your help!

Ram
Tomas Restrepo (MVP) - 31 Jul 2005 15:27 GMT
Ram,
> Does the number of connections affects the performance of my serviced
> component?
It shouldn't (at least not too bad, those will be taken care of by the GC).

> If not, does is affect it at all?
> And about not reusing the client side references to the object - I have
> an ASP.Net web app that uses my JITA enabled serviced component on each
> postback to the server.
> How can I reuse the connection?

You reuse the connection by using the same client side proxy reference you
had to do another call after the object has been deactivated; when you do
that, COM+ automatically activates another object and attaches it to the
connection you had, transparent to the caller.

That said, you can't use a single one in a static variable for all your
calls...

Signature

Tomas Restrepo
tomasr@mvps.org
http://www.winterdom.com/

Ram - 16 Aug 2005 19:05 GMT
Tomas I'm sorry for the big delay, but I just want to tell you a HUGE
thanks!
You'v made clear what a few books and more than a couple of MS support
guys couldnt explain...
So again, thanks for "helping the community at times of need" ;)

Yours
Ram
Tomas Restrepo (MVP) - 17 Aug 2005 00:43 GMT
Ram,

> Tomas I'm sorry for the big delay, but I just want to tell you a HUGE
> thanks!
> You'v made clear what a few books and more than a couple of MS support
> guys couldnt explain...
> So again, thanks for "helping the community at times of need" ;)

Hey, I'm happy to help :)

Signature

Tomas Restrepo
tomasr@mvps.org
http://www.winterdom.com/


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.