Define Client Activated Objects (CAO).- Client-activated objects are objects whose lifetimes are controlled by the client, i.e. calling application domain. This mode works in similar fashion to the model where object is local to the client and referenced object's lifetime is controlled by the calling object. When instance of server object is created, object reference is obtained in the form of proxy.
- In COM model, clients hold an object in memory by holding a reference to it. The object is released from the memory when the entire client releases the reference. But in .Net Remoting, client-activated objects use lifetime leases to determine how long they should continue to exist. When a client creates a remote object, it can specify a default length of time that the object should exist. If the remote object reaches its default lifetime limit, it contacts the client to ask whether it should continue to exist, and if so, for how much longer. If the client is not currently available, a default time is also specified for how long the server object should wait while trying to contact the client before marking itself for garbage collection. The client might even request an indefinite default lifetime. Client-activated instances serve only the client and the reference that was responsible for their creation.
- To create an instance of a client-activated type, clients either configure their application programmatically or using a configuration file and call new, or they pass the remote object's configuration in a call to Activator.CreateInstance.
|