System.Runtime.Remoting.Lifetime.Lease.LeaseExpired C# (CSharp) 메소드

LeaseExpired() 개인적인 메소드

private LeaseExpired ( System.DateTime now ) : void
now System.DateTime
리턴 void
        internal void LeaseExpired(DateTime now)
        {
            lock(this)
            {
                BCLDebug.Trace("REMOTE","Lease ",id," LeaseExpired state ",((Enum)state).ToString());
                if (state == LeaseState.Expired)
                    return;

                // There is a small window between the time the leaseManager
                // thread examines all the leases and tests for expiry and 
                // when an indivisual lease is locked for expiry. The object 
                // could get marshal-ed in this time which would reset its lease
                // Therefore we check again to see if we should indeed proceed
                // with the expire code (using the same value of 'now' as used
                // by the leaseManager thread)
                if (leaseTime.CompareTo(now) < 0)
                    ProcessNextSponsor();
            }
        }

Usage Example

예제 #1
0
        private void LeaseTimeAnalyzer(object state)
        {
            DateTime utcNow = DateTime.UtcNow;

            lock (this.leaseToTimeTable)
            {
                IDictionaryEnumerator local_3 = this.leaseToTimeTable.GetEnumerator();
                while (local_3.MoveNext())
                {
                    DateTime local_4 = (DateTime)local_3.Value;
                    Lease    local_5 = (Lease)local_3.Key;
                    if (local_4.CompareTo(utcNow) < 0)
                    {
                        this.tempObjects.Add((object)local_5);
                    }
                }
                for (int local_6 = 0; local_6 < this.tempObjects.Count; ++local_6)
                {
                    this.leaseToTimeTable.Remove((object)(Lease)this.tempObjects[local_6]);
                }
            }
            for (int index = 0; index < this.tempObjects.Count; ++index)
            {
                Lease lease = (Lease)this.tempObjects[index];
                if (lease != null)
                {
                    lease.LeaseExpired(utcNow);
                }
            }
            this.tempObjects.Clear();
            lock (this.sponsorTable)
            {
                IDictionaryEnumerator local_10 = this.sponsorTable.GetEnumerator();
                while (local_10.MoveNext())
                {
                    object temp_72 = local_10.Key;
                    LeaseManager.SponsorInfo local_11 = (LeaseManager.SponsorInfo)local_10.Value;
                    if (local_11.sponsorWaitTime.CompareTo(utcNow) < 0)
                    {
                        this.tempObjects.Add((object)local_11);
                    }
                }
                for (int local_12 = 0; local_12 < this.tempObjects.Count; ++local_12)
                {
                    this.sponsorTable.Remove(((LeaseManager.SponsorInfo) this.tempObjects[local_12]).sponsorId);
                }
            }
            for (int index = 0; index < this.tempObjects.Count; ++index)
            {
                LeaseManager.SponsorInfo sponsorInfo = (LeaseManager.SponsorInfo) this.tempObjects[index];
                if (sponsorInfo != null && sponsorInfo.lease != null)
                {
                    sponsorInfo.lease.SponsorTimeout(sponsorInfo.sponsorId);
                    this.tempObjects[index] = (object)null;
                }
            }
            this.tempObjects.Clear();
            this.leaseTimer.Change((int)this.pollTime.TotalMilliseconds, -1);
        }
All Usage Examples Of System.Runtime.Remoting.Lifetime.Lease::LeaseExpired