Object pooling is a great instance management service, but what should you do when you deal with rich clients who can hold onto object references for long periods of time? It is one thing if the rich clients make intensive use of the object, but as you saw earlier, they actually maintain the reference on the object to improve performance on their side, and may actually call methods on the object for only a fraction of that time. From the object’s perspective, it must still hold onto its resources because a call may come through at any moment. Object pooling is of little benefit, since it saves you the cost of creating the object, not the cost of maintaining it while tied up with a client. Clearly, another tactic is required to handle greedy Intranet clients.
COM+ provides another instance management technique called
Just-in-Time Activation (JITA) that allows you
to dedicate an object per client only while a call is in progress.
JITA is most useful when instantiating the object is not a costly
operation compared with the expensive or scarce resources the object
holds onto. It is especially useful if the object holds onto them for
How JITA Works
JITA intercepts the call from the client to the object, activates the object just when the client issues a method call, and then destroys the object as soon as the method returns. As a result, the client must never have a direct reference to the object. As explained in Chapter 2, if the client is in a ...