Exemplo n.º 1
0
        public async System.Threading.Tasks.Task Test1Async()
        {
            IEnumerable <string> resources = new List <string> {
                "aa", "bb", "cc"
            };

            IDistributedLock lock1 = await _lockManager.LockAsync(
                resources : resources,
                expiryTime : TimeSpan.FromSeconds(20),
                waitTime : (TimeSpan?)TimeSpan.FromSeconds(10),
                retryInterval : (TimeSpan?)TimeSpan.FromSeconds(1)).ConfigureAwait(false);

            await Task.Delay(5 * 1000).ConfigureAwait(false);

            lock1.Dispose();
        }
Exemplo n.º 2
0
 protected override void StopInternal()
 {
     _innerProcess.Stop().Wait();
     _dlock?.Dispose();
     base.StopInternal();
 }