using System; using System.Collections; using System.Threading; namespace System.Runtime.Remoting.Lifetime { // Token: 0x020003D2 RID: 978 internal class LeaseManager { // Token: 0x0600267B RID: 9851 RVA: 0x0007EC54 File Offset: 0x0007CE54 public void SetPollTime(TimeSpan timeSpan) { object syncRoot = this._objects.SyncRoot; lock (syncRoot) { if (this._timer != null) { this._timer.Change(timeSpan, timeSpan); } } } // Token: 0x0600267C RID: 9852 RVA: 0x0007ECB4 File Offset: 0x0007CEB4 public void TrackLifetime(ServerIdentity identity) { object syncRoot = this._objects.SyncRoot; lock (syncRoot) { identity.Lease.Activate(); this._objects.Add(identity); if (this._timer == null) { this.StartManager(); } } } // Token: 0x0600267D RID: 9853 RVA: 0x0007ED24 File Offset: 0x0007CF24 public void StopTrackingLifetime(ServerIdentity identity) { object syncRoot = this._objects.SyncRoot; lock (syncRoot) { this._objects.Remove(identity); } } // Token: 0x0600267E RID: 9854 RVA: 0x0007ED78 File Offset: 0x0007CF78 public void StartManager() { this._timer = new Timer(new TimerCallback(this.ManageLeases), null, LifetimeServices.LeaseManagerPollTime, LifetimeServices.LeaseManagerPollTime); } // Token: 0x0600267F RID: 9855 RVA: 0x0007EDA8 File Offset: 0x0007CFA8 public void StopManager() { Timer timer = this._timer; this._timer = null; timer.Dispose(); } // Token: 0x06002680 RID: 9856 RVA: 0x0007EDCC File Offset: 0x0007CFCC public void ManageLeases(object state) { object syncRoot = this._objects.SyncRoot; lock (syncRoot) { int i = 0; while (i < this._objects.Count) { ServerIdentity serverIdentity = (ServerIdentity)this._objects[i]; serverIdentity.Lease.UpdateState(); if (serverIdentity.Lease.CurrentState == LeaseState.Expired) { this._objects.RemoveAt(i); serverIdentity.OnLifetimeExpired(); } else { i++; } } if (this._objects.Count == 0) { this.StopManager(); } } } // Token: 0x04000EFD RID: 3837 private ArrayList _objects = new ArrayList(); // Token: 0x04000EFE RID: 3838 private Timer _timer; } }