Server-Activated Vs Client-Activated Objects

Server-activated objects are objects whose lifetimes are directly controlled by the server. Server-activated objects are created by the server only when they are needed. They are created when the client invokes the first method on that proxy. Singleton is one of activation modes for server-activated objects. Singleton objects are objects for which there will always be only one instance, regardless of how many clients there are for that object. If an instance does not exist, the server creates an instance and all subsequent client requests will be serviced by that instance.

  • Use server-activated objects when there are clients sharing the same server object. In this case, there is always only one server object exists at any time (singleton of the same kind). The server object is created by the server on the first method on that proxy from any client. It’s a one-to-many relationship between the server object and clients.

Client-activated objects are objects whose lifetimes are controlled by the calling application domain, just as they would be if the object were local to the client. Client-activated objects are created on the server when the client calls new. The client itself, using the lifetime lease system, can participate in the lifetime of the instance. If a calling application domain creates two new instances of the remote type, each of the client references will invoke only the particular instance in the server application domain from which the reference was returned.

  • Use client-activated objects when multiple server instances of the same kind need to be run on the server at the same time. In this case, each of the server instances is created when a client calls new on the server object. The server instance is available for the calling client only. The lifetime of the instance is depending on the lifetime lease system. It’s a one-to-one relationship between each server object and its corresponding client.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.