Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/OrleansProviders/Storage/HierarchicalKeyStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ internal class HierarchicalKeyStore : MarshalByRefObject, ILocalDataStore
[NonSerialized]
private readonly IDictionary<string, IDictionary<string, object>> dataTable;
private readonly int numKeyLayers;
private readonly object lockable = new object();

public HierarchicalKeyStore(int keyLayers)
{
Expand All @@ -57,7 +58,7 @@ public string WriteRow(IList<Tuple<string, string>> keys, IDictionary<string, ob
throw new ArgumentOutOfRangeException("keys", keys.Count, error);
}

lock (this)
lock (lockable)
{
var storedData = GetDataStore(keys);

Expand Down Expand Up @@ -85,7 +86,7 @@ public IDictionary<string, object> ReadRow(IList<Tuple<string, string>> keys)
throw new ArgumentOutOfRangeException("keys", keys.Count, error);
}

lock (this)
lock (lockable)
{
IDictionary<string, object> data = GetDataStore(keys);

Expand All @@ -105,7 +106,7 @@ public IList<IDictionary<string, object>> ReadMultiRow(IList<Tuple<string, strin
string.Format("Too many key supplied -- Expected count = {0} Received = {1}", numKeyLayers, keys.Count));
}

lock (this)
lock (lockable)
{
IList<IDictionary<string, object>> results = FindDataStores(keys);
#if DEBUG
Expand All @@ -127,7 +128,7 @@ public bool DeleteRow(IList<Tuple<string, string>> keys, string eTag)
string keyStr = MakeStoreKey(keys);

bool removedEntry = false;
lock (this)
lock (lockable)
{
IDictionary<string, object> data;
if (dataTable.TryGetValue(keyStr, out data))
Expand All @@ -153,7 +154,7 @@ public void Clear()
#if DEBUG
Trace.TraceInformation("Clear Table");
#endif
lock (this)
lock (lockable)
{
dataTable.Clear();
}
Expand All @@ -162,7 +163,7 @@ public void Clear()
public string DumpData(bool printDump = true)
{
var sb = new StringBuilder();
lock (this)
lock (lockable)
{
string[] keys = dataTable.Keys.ToArray();
foreach (var key in keys)
Expand All @@ -184,7 +185,7 @@ private IDictionary<string, object> GetDataStore(IList<Tuple<string, string>> ke
{
string keyStr = MakeStoreKey(keys);

lock (this)
lock (lockable)
{
IDictionary<string, object> data;
if (dataTable.ContainsKey(keyStr))
Expand Down Expand Up @@ -215,7 +216,7 @@ private IList<IDictionary<string, object>> FindDataStores(IList<Tuple<string, st
{
string keyStr = MakeStoreKey(keys);

lock (this)
lock (lockable)
{
foreach (var key in dataTable.Keys)
if (key.StartsWith(keyStr))
Expand Down
3 changes: 2 additions & 1 deletion src/OrleansRuntime/GrainTypeManager/GrainTypeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ internal class GrainTypeManager
private readonly TraceLogger logger = TraceLogger.GetLogger("GrainTypeManager");
private readonly GrainInterfaceMap grainInterfaceMap;
private readonly Dictionary<int, InvokerData> invokers = new Dictionary<int, InvokerData>();
private static readonly object lockable = new object();

public static GrainTypeManager Instance { get; private set; }

Expand All @@ -50,7 +51,7 @@ public static void Stop()
public GrainTypeManager(bool localTestMode)
{
grainInterfaceMap = new GrainInterfaceMap(localTestMode);
lock (typeof (GrainTypeManager))
lock (lockable)
{
if (Instance != null)
throw new InvalidOperationException("An attempt to create a second insance of GrainTypeManager.");
Expand Down
7 changes: 4 additions & 3 deletions src/OrleansRuntime/Silo/Silo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public SiloType Type
private readonly TimeSpan stopTimeout = TimeSpan.FromMinutes(1);
private readonly Catalog catalog;
private readonly List<IHealthCheckParticipant> healthCheckParticipants;
private readonly object lockable = new object();


internal readonly string Name;
Expand Down Expand Up @@ -357,7 +358,7 @@ public void Start()

private void DoStart()
{
lock (this)
lock (lockable)
{
if (SystemStatus.Current != SystemStatus.Created)
throw new InvalidOperationException(String.Format("Calling Silo.Start() on a silo which is not in the Start state. This silo is in the {0} state.", SystemStatus.Current));
Expand Down Expand Up @@ -523,7 +524,7 @@ private void ConfigureThreadPoolAndServicePointSettings()
public void Stop()
{
bool stopAlreadyInProgress = false;
lock (this)
lock (lockable)
{
if (SystemStatus.Current.Equals(SystemStatus.Stopping) ||
SystemStatus.Current.Equals(SystemStatus.ShuttingDown) ||
Expand Down Expand Up @@ -649,7 +650,7 @@ private void HandleProcessExit(object sender, EventArgs e)

try
{
lock (this)
lock (lockable)
{
if (SystemStatus.Current != SystemStatus.Running) return;

Expand Down