Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
Member Area
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Become a Member
-Why sign up!
-Chat Online!
-Indexes NEW!!
-Build your resume
-Find a job
-Post a job
-Resume Search
-Link to us
Visit Embarcadero
Embarcadero Community
JIT Activation/Deactivation in COM+ Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Delphi 4.x
User Rating
# Votes
DSP, Administrator
Reference URL:
			Author: S S B Magesh Puvananthiran

What is JIT Activation/Deactivation? Why do we need this?


Why do we need this service? 

In an application using COM objects, a COM object will be created when you call a 
method like CreateCOMObject etc., So once that method is called, that specific COM 
object will be created and the application can call the methods of that object. In 
other words, that COM object will be activated after that call to CreateCOMObject. 
Right.. That object will be in memory as long as any one of the applications is 
holding a reference to that object irrespective of whether that application is 
calling the object's methods or not. So the bottomline is a valuable memory 
resource is wasted if the application is not actively using the COM object. 

JIT Activation/Deactivation is introduced in COM+ mainly for the effective usage of 
reources and to avoid the resource wastage as mentioned above. 

What is JIT Activation/Deactivation? 

It is one of the services provided by COM+ runtime.JIT stands for Just-In-Time. In 
COM+, we can set this service to a COM object through the Component Services 

How does it function? 

Once you set this service to a COM object through the Component Services Explorer, 
the activation of that COM object is delayed until one of its methods is first 
called. So even though you call the CreateCOMObject methods and get a reference to 
that COM object, that object will not be activated until you call one of its 
methods. Also once every method call is completed, that COM object will be 
deactivated to conserve resource. 


As I mentioned above, the main advantage is that the reources will be effectively 
used. Since every time you call a method/property of that COM object, that COM 
object will be activated every time. Consider the following scenerio: 

1   begin
2     COMObj := CreateCOMObject("...");
3     COMObj.Name := 'My Name';
4     COMObj.SSN := '737387289';
5     { ..................................
6      ...............................etc., }
7     COMObj.UpdateDetails;
8   end;

In the sample code above, I created a COM Object and set some properties and call 
UpdateDetails method to update the Name and SSN details. Let us assume that the 
COMObj is using the JIT Activation/Deactivation service provided in the Component 
Services Explorer. So every time a property value is assigned, a new COM object 
will be activated and deactivated once that value is assigned. Finally when you 
call the UpdateDetails method, a new COM object will be activated and it doesn't 
know anything of the previous assignment and so the values will not be updated. 
Then what is the use of this JIT Activation/Deactivation? We have to change the 
approach in writing COM object. The alternate for the above code would be like 

9   begin
10    COMObj := CreateCOMObject("");
11    COMObj.UpdateDetails "My Name", "737387289", ...etc.,
12  end;

So after that call is over, the object will be deactivated. The method 
UpdateDetails will get all the info as parameters to that method. We can consider 
this either as an advantage or disadvantage. 

Another question that comes to our mind now is how much time will that COM+ runtime take to activate/deactivate a COM object? But people using COM+ are claiming that the time taken to activate/deactivate a COM object is very less. How much? Do you people at Delphi3000 community have any ideas about that? Is it worth having JIT Activation/Deactivation service? Please feel free to post your views and letz start a discussion on that as I continue to explore more into COM and COM+. Also if any one of our community people have any experience on using these services, please feel free to share. 

Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10


Share this page
Download from Google

Copyright © Mendozi Enterprises LLC