Understanding SAO and CAO Activation Methods in .NET Remoting
page 6 of 9
by Abhishek Kumar Singh
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 40189/ 59

CAO activation implementation

In CAO, the server object's lifetime is controlled by clients, which is the reason we do not normally prefer this activation method in remoting applications. Not preferring CAO is good when the server does most of the critical business logic and execution. But when the client performs critical tasks where data loss may affect the system, then we may need to choose CAO instead of SAO.

When we register ActivatedClientType at the client then we create the remote object using new operator- server initialize instance of remote object. So it means the server executes default constructor.

The server executes the constructor for each client only once unless and until the client gets restarted or creates new instance of remote object again for subsequent remote method call.

Since the server creates the remote object instance for each client separately, class variables can be common for specific clients only. It means we can have state management for client by client separately, which will not be common to all clients. It also means that we can manage state of particular among all method calls of the same client at the server. Therefore, in CAO remoting implementation we can not have single server object intendance to serve all clients.

In CAO remoting implementation server object never gets garbage collected even if it remains idle for long or all clients stop invoking remote methods. The lifetime of server object instance is controlled by the respective clients. CAO is also called statefull objects.

A Client can use either of the following ways to create CAO object at the server

Using New operator to create object instance

Limitation in this approach - Unlike SAO’s, you can not use shared interface or base classes. It means that you will need to provide your compiled server class to the client application. Sharing the actual server implementation to the client is not a feasible way. One better option would be to use soapsuds on server object to get the metadata which could be used by the client.

Using Activator.CreateInstance method

You can use it to create remote object instance by passing constructor parameters.

View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-07-15 4:17:08 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search