Example #1
0
        protected override async Task ReleaseLease(Lease <T> lease)
        {
            if (!workInProgress.Values.Any(l => l.GetHashCode().Equals(lease.GetHashCode())))
            {
                Debug.WriteLine("[Distribute] ReleaseLease (failed): " + lease);
                return;
            }

            Lease <T> _;

            if (workInProgress.TryRemove(lease.Leasable, out _))
            {
                lease.NotifyReleased();
                Debug.WriteLine("[Distribute] ReleaseLease: " + lease);
            }

            lease.NotifyCompleted();
        }