S
Sathyaish
Do SingleCall server activation mode objects retain their state across
different calls?
For e.g.
Server code:
------------
//RemoteServerObject's activation mode is server activation. The
WellKnownObjectMode enum value assigned is SingleCall, done in config
file.
public class RemoteServerObject: MarshalByRef
{
private int _value = 0;
public void SetValue(int value)
{
this._value = value;
}
public int GetValue()
{
return this._value;
}
}
Client code:
-------------
RemoteServerObject r = new RemoteServerObject(); //Nothing happens
here
r.SetValue(3); //New instance of RemoteServerObject created on server.
It's _value set to 3.
/* Suppose that the lifetime lease of r expires here */
Console.WriteLine( r.GetValue().ToString() ); //Another instance
created by server. Question: Will this instance retain the value 3?
My common sense says that the remoting infrastructure would persist
state of the object across its various lifetimes. but I don't know for
sure.
different calls?
For e.g.
Server code:
------------
//RemoteServerObject's activation mode is server activation. The
WellKnownObjectMode enum value assigned is SingleCall, done in config
file.
public class RemoteServerObject: MarshalByRef
{
private int _value = 0;
public void SetValue(int value)
{
this._value = value;
}
public int GetValue()
{
return this._value;
}
}
Client code:
-------------
RemoteServerObject r = new RemoteServerObject(); //Nothing happens
here
r.SetValue(3); //New instance of RemoteServerObject created on server.
It's _value set to 3.
/* Suppose that the lifetime lease of r expires here */
Console.WriteLine( r.GetValue().ToString() ); //Another instance
created by server. Question: Will this instance retain the value 3?
My common sense says that the remoting infrastructure would persist
state of the object across its various lifetimes. but I don't know for
sure.