.NET Remoting object Lifetime
-
29-10-2019 - |
Question
I wrote this code:
public class Message : MarshalByRefObject, IMessage
{
...
public override object InitializeLifetimeService()
{
ILease leas = (ILease) base.InitializeLifetimeService();
if (leas != null)
{
if(leas.CurrentState == LeaseState.Initial)
{
leas.InitialLeaseTime = TimeSpan.FromMilliseconds(2000);
leas.SponsorshipTimeout = TimeSpan.Zero;
leas.RenewOnCallTime = TimeSpan.Zero;
}
}
return leas;
}
}
Does the override of InitializeLifetimeService grantee that after 2 seconds the object is no "garbage collected"? I mean, independently if this instance was remotely accessed or not.
Thank you.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow