aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Monitoring/ChecksManager.cs
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Framework/Monitoring/ChecksManager.cs
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Framework/Monitoring/ChecksManager.cs')
-rw-r--r--OpenSim/Framework/Monitoring/ChecksManager.cs45
1 files changed, 21 insertions, 24 deletions
diff --git a/OpenSim/Framework/Monitoring/ChecksManager.cs b/OpenSim/Framework/Monitoring/ChecksManager.cs
index e4a7f8c..ff3b041 100644
--- a/OpenSim/Framework/Monitoring/ChecksManager.cs
+++ b/OpenSim/Framework/Monitoring/ChecksManager.cs
@@ -132,8 +132,8 @@ namespace OpenSim.Framework.Monitoring
132 /// <returns></returns> 132 /// <returns></returns>
133 public static bool RegisterCheck(Check check) 133 public static bool RegisterCheck(Check check)
134 { 134 {
135 SortedDictionary<string, SortedDictionary<string, Check>> category = null, newCategory; 135 SortedDictionary<string, SortedDictionary<string, Check>> category = null;
136 SortedDictionary<string, Check> container = null, newContainer; 136 SortedDictionary<string, Check> container = null;
137 137
138 lock (RegisteredChecks) 138 lock (RegisteredChecks)
139 { 139 {
@@ -146,19 +146,15 @@ namespace OpenSim.Framework.Monitoring
146 // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed. 146 // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed.
147 // This means that we don't need to lock or copy them on iteration, which will be a much more 147 // This means that we don't need to lock or copy them on iteration, which will be a much more
148 // common operation after startup. 148 // common operation after startup.
149 if (container != null) 149 if (container == null)
150 newContainer = new SortedDictionary<string, Check>(container); 150 container = new SortedDictionary<string, Check>();
151 else
152 newContainer = new SortedDictionary<string, Check>();
153 151
154 if (category != null) 152 if (category == null)
155 newCategory = new SortedDictionary<string, SortedDictionary<string, Check>>(category); 153 category = new SortedDictionary<string, SortedDictionary<string, Check>>();
156 else
157 newCategory = new SortedDictionary<string, SortedDictionary<string, Check>>();
158 154
159 newContainer[check.ShortName] = check; 155 container[check.ShortName] = check;
160 newCategory[check.Container] = newContainer; 156 category[check.Container] = container;
161 RegisteredChecks[check.Category] = newCategory; 157 RegisteredChecks[check.Category] = category;
162 } 158 }
163 159
164 return true; 160 return true;
@@ -171,23 +167,24 @@ namespace OpenSim.Framework.Monitoring
171 /// <returns></returns> 167 /// <returns></returns>
172 public static bool DeregisterCheck(Check check) 168 public static bool DeregisterCheck(Check check)
173 { 169 {
174 SortedDictionary<string, SortedDictionary<string, Check>> category = null, newCategory; 170 SortedDictionary<string, SortedDictionary<string, Check>> category = null;
175 SortedDictionary<string, Check> container = null, newContainer; 171 SortedDictionary<string, Check> container = null;
176 172
177 lock (RegisteredChecks) 173 lock (RegisteredChecks)
178 { 174 {
179 if (!TryGetCheckParents(check, out category, out container)) 175 if (!TryGetCheckParents(check, out category, out container))
180 return false; 176 return false;
181 177
182 newContainer = new SortedDictionary<string, Check>(container); 178 if(container != null)
183 newContainer.Remove(check.ShortName); 179 {
184 180 container.Remove(check.ShortName);
185 newCategory = new SortedDictionary<string, SortedDictionary<string, Check>>(category); 181 if(category != null && container.Count == 0)
186 newCategory.Remove(check.Container); 182 {
187 183 category.Remove(check.Container);
188 newCategory[check.Container] = newContainer; 184 if(category.Count == 0)
189 RegisteredChecks[check.Category] = newCategory; 185 RegisteredChecks.Remove(check.Category);
190 186 }
187 }
191 return true; 188 return true;
192 } 189 }
193 } 190 }