From 5dcbad22355411b042eafaffaa1dcbd36c4f9af8 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Sat, 22 Aug 2015 17:51:34 +0100 Subject: [PATCH] Formatted code. Moved static members to top of class. --- .../Tasks/Locking/Services/DistributedLock.cs | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Orchard/Tasks/Locking/Services/DistributedLock.cs b/src/Orchard/Tasks/Locking/Services/DistributedLock.cs index cd7143fc1..05977bea4 100644 --- a/src/Orchard/Tasks/Locking/Services/DistributedLock.cs +++ b/src/Orchard/Tasks/Locking/Services/DistributedLock.cs @@ -7,23 +7,6 @@ namespace Orchard.Tasks.Locking.Services { /// Represents a distributed lock. /> /// public class DistributedLock : IDisposable { - private IDistributedLockService _service; - private int _isDisposed; - - private DistributedLock() { - } - - public string Id { get; private set; } - public string Name { get; private set; } - public string MachineName { get; private set; } - public int? ThreadId { get; private set; } - - // This will be called at least and at the latest by the IoC container when the request ends. - public void Dispose() { - if(Interlocked.CompareExchange(ref _isDisposed, 1, 0) == 0) - _service.ReleaseLock(this); - } - public static DistributedLock ForMachine(IDistributedLockService service, string name, string machineName, string lockId) { return new DistributedLock { _service = service, @@ -42,5 +25,22 @@ namespace Orchard.Tasks.Locking.Services { Id = lockId }; } + + private IDistributedLockService _service; + private int _isDisposed; + + private DistributedLock() { + } + + public string Id { get; private set; } + public string Name { get; private set; } + public string MachineName { get; private set; } + public int? ThreadId { get; private set; } + + // This will be called at least and at the latest by the IoC container when the request ends. + public void Dispose() { + if(Interlocked.CompareExchange(ref _isDisposed, 1, 0) == 0) + _service.ReleaseLock(this); + } } } \ No newline at end of file