RE: [Backalaika-developers] Important question to Fabio at the end
Status: Beta
Brought to you by:
nandof
From: Fabio P. <fpi...@ho...> - 2004-09-28 08:49:10
|
>When we talk about remoting, server-activated objects have two possible >activation modes (or WellKnownObjectMode values): Singleton and SingleCall. >These are at opposite ends of a spectrum. SingleCall is stateful: the >remote object is only accessed once, the next time it >will be a different object. Singleton means only one object is created and >accessed by all clients. Nando, I don't agree with the phrase, "SingleCall is stateful". I agree that with SingleCall objects, every remote method call is serviced by a new object instance. Then how can SingleCall be stateful then? If a previous method call saved some state information in one or more fields of the SingleCall object, they will be lost. Singleton objects are stateful. As you said, once a Singleton object is created, all clients get the same reference (although note that this will only occur if the object is given infinite lifetime, or it's lease is renewed). >I think singleton remoting would be appropriate for us. I do agree. >Fabio, FileServerBackup inherits from MarshalByRefObject, this means you >also intend it to be server-activated. Yes, FileServer.Backup is intended to be server-activated. The fact that it inherits from MarshalByRefObject only means that the type is intended to be accessed across application domain boundaries. This does not specify whether it will be client or server activated. What specifies this is how we configure the .NET remoting infrastructure using RemotingConfiguration class. >But there's a difference between *singleton remoting* and *a class written >in the singleton pattern*. >Can you explain why the singleton class pattern is needed for >FileServerBackup then? I ask because I have never seen anyone say that >*singleton remoting* requires a *singleton type*, nor > any examples >suggesting it. Yes, as long as type to be remoted inherits from MarshalByRefObject, it is suitable for singleton remoting (if .NET remoting infrastructure is configured accordingly). Type does not have to be a singleton type (type implementing Singleton design pattern or anything else for that matter). Let me think about this some more ;-) Fabio _________________________________________________________________ Get the latest polyphonic ringtones at MSN Mobile Fun! http://ringtones.msn.co.za/ |