Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2005

Tip: Looking for answers? Try searching our database.

newbie question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gladiator - 31 May 2005 06:24 GMT
what is difference between server_Activation and client_activation?
TIA.
Mona - 31 May 2005 07:20 GMT
Hi Tia,

There are two types of activation for marshal-by-reference objects:

Server activation.
Server-activated objects are created by the server only when they are needed.
They are not created when the client proxy is created by calling new or Activator.GetObject,
but rather when the client invokes the first method on that proxy. For details, see Server Activation.

You use the the WellKnownObjectMode enumeration to configure server-activated objects as
Singleton or SingleCall objects. Singleton objects are objects for which there will always be
only one instance, regardless of how many clients there are for that object, and which have a
default lifetime. (The client can use the lifetime lease system to participate in the lifetime of
Singleton instances. For details, see Lifetime Leases.) When you configure an object to be a
SingleCall object, the system creates a new object for each client method invocation. Because a
client will get a reference to a new instance on each invocation, SingleCall types do not participate
in the lifetime lease system.

You can refer to the following link for more information on Server Activation:
[Server Activation]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conserveractivation.asp


Client activation.
Client-activated objects are created on the server when the client calls new or Activator.CreateInstance.
The client itself, using the lifetime lease system, can participate in the lifetime of these instances.

You can refer to the following link for more information on Client Activation:
[Client Activation]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conclientactivation.asp


HTH

Mona[Grapecity]

> what is difference between server_Activation and client_activation?
> TIA
Richard Blewett [DevelopMentor] - 31 May 2005 08:21 GMT
To me the main difference is that server activated objects are generally useful whereas client activated ones are not

I obviously need to expand on that ;-)

Server activation supports two modes: Singleton and SingleCall. Singleton means that there is only once instance at a time servicing calls (it does not mean a single instance will service every call over the lifetime of your application because of the distributed garbage collection infrastructure - if no one calls it for a while it will be disconnected from the remoting infrastructure when its lease expires). SingleCall means every call gets a new instance.

Client activation means each client gets their own copy (or multiple copies I guess if they make multiple calls to Activator.CreateInstance).

So the issue is "why would I use client activation?". The only real use of this that I have come across is to maintain per-client state in a simple way. Heres why I think this is a bad idea:

1) if the process dies you lose all of you per-client state
2) you cannot load balance the application as all state for a particular client is held in memory in a single process
3) You have to pay attention to the demands of distributed lifetime management

Its better IMO to use Singletons, keep the per-client state in a database and pass a client identifier in each method call. With singletons you have to ensure that you are not keeping state in the object itself (or pay the cost of thread synchronization which makes the code harder to write - but this can be alleviated by use of a ReaderWriterLock).

As far as the client getting involved in the lifetime policy of the object, this invloves having to register a sponsor for the object. The lease manager will now call the sponsor to check if its OK to disconnect the object when the lease expires. This is bascially a re-implementation of the DCOM ping architecture (although now you can configure the timeouts). The problem with this is that in complex systems the ping traffic became significant. Also the ping tended to be blocked by firewalls (as they often let traffic through in one direction but not the other way) because for sponsors to work the server has to call the client (you get the same issues with remoting callbacks).

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

  Hi Tia,   There are two types of activation for marshal-by-reference objects:   Server activation.
Server-activated objects are created by the server only when they are needed. They are not created when the client proxy is created by calling new or Activator.GetObject, but rather when the client invokes the first method on that proxy. For details, see Server Activation.   You use the the WellKnownObjectMode enumeration to configure server-activated objects as Singleton or SingleCall objects. Singleton objects are objects for which there will always be only one instance, regardless of how many clients there are for that object, and which have a default lifetime. (The client can use the lifetime lease system to participate in the lifetime of Singleton instances. For details, see Lifetime Leases.) When you configure an object to be a SingleCall object, the system creates a new object for each client method invocation. Because a client will get a reference to a new instance on each invocation, SingleCall types do not participate in the lifetime lease system.   You can refer to the following link for more information on Server Activation: [Server Activation] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conserveractivation.asp
   Client activation.
Client-activated objects are created on the server when the client calls new or Activator.CreateInstance. The client itself, using the lifetime lease system, can participate in the lifetime of these instances.    You can refer to the following link for more information on Client Activation: [Client Activation] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conclientactivation.asp
   HTH   Mona[Grapecity]   "gladiator" <gladiator@discussions.microsoft.com> wrote in message news:682444CD-A544-40C9-9BFA-CFD8B26DE290@microsoft.com... > what is difference between server_Activation and client_activation?
> TIA.   This post contained attachments. By default, NewsGator will not download attachments, but can be configured to do so. If you wish to automatically download attachments for this newsgroup, go to NewsGator/Subscriptions, select this group and click Edit, and change the Options.


[microsoft.public.dotnet.framework]

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.