forked from PeterWaher/IoTGateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClusterResourceLockEventArgs.cs
More file actions
51 lines (46 loc) · 1.76 KB
/
ClusterResourceLockEventArgs.cs
File metadata and controls
51 lines (46 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Net;
namespace Waher.Networking.Cluster
{
/// <summary>
/// Event arguments for cluster resource lock events.
/// </summary>
/// <param name="Sender">Sender of event.</param>
/// <param name="e">Event handler.</param>
public delegate void ClusterResourceLockEventHandler(object Sender, ClusterResourceLockEventArgs e);
/// <summary>
/// Event arguments for cluster resource lock events.
/// </summary>
public class ClusterResourceLockEventArgs : ClusterResourceEventArgs
{
private readonly IPEndPoint lockedBy;
private readonly bool lockSuccessful;
/// <summary>
/// Event arguments for cluster resource lock events.
/// </summary>
/// <param name="Resource">Resource name</param>
/// <param name="LockSuccessful">If lock-operation was successful.</param>
/// <param name="LockedBy">Identity of endpoint having the resource locked, if not successful.</param>
/// <param name="State">State object passed on to the original request.</param>
public ClusterResourceLockEventArgs(string Resource, bool LockSuccessful,
IPEndPoint LockedBy, object State)
: base(Resource, State)
{
this.lockedBy = LockedBy;
this.lockSuccessful = LockSuccessful;
}
/// <summary>
/// If the lock operation was successful or not. If not,
/// <see cref="LockedBy"/> contains information about what
/// endpoint has the resource locked.
/// </summary>
public bool LockSuccessful => this.lockSuccessful;
/// <summary>
/// If lock was not successful, this is the endpoint that has the
/// resource locked. If null, and <see cref="LockSuccessful"/> is false,
/// it is the same machine that has the resource already locked.
/// </summary>
public IPEndPoint LockedBy => this.lockedBy;
}
}