3
我從MarshalByRefObject
繼承的類,並在它我重寫終身服務給它兩個InitialLeaseTime
一個小時:我可以掛鉤遠程對象的到期嗎?
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;
}
現在,我想在租約到期執行一些邏輯。到期是否有事件或掛鉤?我搜索了Google和MSDN,但我什麼也沒找到。
謝謝!