Exemplo n.º 1
0
 /// <summary>
 /// Creates a new instance of the DistributedLock class.
 /// </summary>
 /// <param name="store">The object store where the object exists.</param>
 /// <param name="staleLockMultiplier">A multiplier used to determine if a previously locked object is stale. Setting this value too short will result in one lock overwriting another.</param>
 public DistributedLock(ISharpLockDataStore <TLockableObject, TId> store, int staleLockMultiplier = 10)
 {
     _store               = store ?? throw new ArgumentNullException(nameof(store));
     _sharpLockLogger     = _store.GetLogger();
     LockTime             = _store.GetLockTime();
     _staleLockMultiplier = staleLockMultiplier;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of the DistributedLock class.
 /// </summary>
 /// <param name="store">The object store where the object exists.</param>
 /// <param name="fieldSelector">A LINQ expression giving the path to the <seealso cref="TLockableObject"/></param>
 /// <param name="staleLockMultiplier">A multiplier used to determine if a previously locked object is stale. Setting this value too short will result in one lock overwriting another.</param>
 public DistributedLock(ISharpLockDataStore <TBaseObject, TLockableObject, TId> store, Expression <Func <TBaseObject, IEnumerable <TLockableObject> > > fieldSelector, int staleLockMultiplier = 5)
     : this(store.GetLogger(), store, staleLockMultiplier)
 {
     _tLockableObjectArrayFieldSelector = fieldSelector ?? throw new ArgumentNullException(nameof(fieldSelector));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new instance of the DistributedLock class.
 /// </summary>
 /// <param name="store">The object store where the object exists.</param>
 /// <param name="staleLockMultiplier">A multiplier used to determine if a previously locked object is stale. Setting this value too short will result in one lock overwriting another.</param>
 public DistributedLock(ISharpLockDataStore <TLockableObject, TId> store, int staleLockMultiplier = 10)
     : this(store.GetLogger(), store, staleLockMultiplier)
 {
 }