I have a class which inherits from MarshalByRefObject
, and in it I am overriding the lifetime service to give it an InitialLeaseTime
of two hours:
public override object InitializeLifetimeService()
{
// Expire after two hours.
var lease = (ILease)base.InitializeLifetimeService();
if (lease.CurrentState == LeaseState.Initial)
lease.InitialLeaseTime = TimeSpan.FromHours(2);
return lease;
}
Now, I want to perform some logic when the lease expires. Is there an event or a hook into the expiration? I have searched Google and MSDN, but I have found nothing.
Thanks!