@@ -41,6 +41,7 @@ internal class HierarchicalKeyStore : MarshalByRefObject, ILocalDataStore
4141 [ NonSerialized ]
4242 private readonly IDictionary < string , IDictionary < string , object > > dataTable ;
4343 private readonly int numKeyLayers ;
44+ private readonly object lockable = new object ( ) ;
4445
4546 public HierarchicalKeyStore ( int keyLayers )
4647 {
@@ -57,7 +58,7 @@ public string WriteRow(IList<Tuple<string, string>> keys, IDictionary<string, ob
5758 throw new ArgumentOutOfRangeException ( "keys" , keys . Count , error ) ;
5859 }
5960
60- lock ( this )
61+ lock ( lockable )
6162 {
6263 var storedData = GetDataStore ( keys ) ;
6364
@@ -85,7 +86,7 @@ public IDictionary<string, object> ReadRow(IList<Tuple<string, string>> keys)
8586 throw new ArgumentOutOfRangeException ( "keys" , keys . Count , error ) ;
8687 }
8788
88- lock ( this )
89+ lock ( lockable )
8990 {
9091 IDictionary < string , object > data = GetDataStore ( keys ) ;
9192
@@ -105,7 +106,7 @@ public IList<IDictionary<string, object>> ReadMultiRow(IList<Tuple<string, strin
105106 string . Format ( "Too many key supplied -- Expected count = {0} Received = {1}" , numKeyLayers , keys . Count ) ) ;
106107 }
107108
108- lock ( this )
109+ lock ( lockable )
109110 {
110111 IList < IDictionary < string , object > > results = FindDataStores ( keys ) ;
111112#if DEBUG
@@ -127,7 +128,7 @@ public bool DeleteRow(IList<Tuple<string, string>> keys, string eTag)
127128 string keyStr = MakeStoreKey ( keys ) ;
128129
129130 bool removedEntry = false ;
130- lock ( this )
131+ lock ( lockable )
131132 {
132133 IDictionary < string , object > data ;
133134 if ( dataTable . TryGetValue ( keyStr , out data ) )
@@ -153,7 +154,7 @@ public void Clear()
153154#if DEBUG
154155 Trace . TraceInformation ( "Clear Table" ) ;
155156#endif
156- lock ( this )
157+ lock ( lockable )
157158 {
158159 dataTable . Clear ( ) ;
159160 }
@@ -162,7 +163,7 @@ public void Clear()
162163 public string DumpData ( bool printDump = true )
163164 {
164165 var sb = new StringBuilder ( ) ;
165- lock ( this )
166+ lock ( lockable )
166167 {
167168 string [ ] keys = dataTable . Keys . ToArray ( ) ;
168169 foreach ( var key in keys )
@@ -184,7 +185,7 @@ private IDictionary<string, object> GetDataStore(IList<Tuple<string, string>> ke
184185 {
185186 string keyStr = MakeStoreKey ( keys ) ;
186187
187- lock ( this )
188+ lock ( lockable )
188189 {
189190 IDictionary < string , object > data ;
190191 if ( dataTable . ContainsKey ( keyStr ) )
@@ -215,7 +216,7 @@ private IList<IDictionary<string, object>> FindDataStores(IList<Tuple<string, st
215216 {
216217 string keyStr = MakeStoreKey ( keys ) ;
217218
218- lock ( this )
219+ lock ( lockable )
219220 {
220221 foreach ( var key in dataTable . Keys )
221222 if ( key . StartsWith ( keyStr ) )
0 commit comments