diff options
author | UbitUmarov | 2016-08-24 07:41:11 +0100 |
---|---|---|
committer | UbitUmarov | 2016-08-24 07:41:11 +0100 |
commit | 387d564aadc38c28af78d5b60a3bad57f1a8a2d5 (patch) | |
tree | d52a739f92077612d2ee7e416b76ef0e01b3d6fe /OpenSim/Framework | |
parent | remove redundate console comand add, change stat deregister (diff) | |
download | opensim-SC_OLD-387d564aadc38c28af78d5b60a3bad57f1a8a2d5.zip opensim-SC_OLD-387d564aadc38c28af78d5b60a3bad57f1a8a2d5.tar.gz opensim-SC_OLD-387d564aadc38c28af78d5b60a3bad57f1a8a2d5.tar.bz2 opensim-SC_OLD-387d564aadc38c28af78d5b60a3bad57f1a8a2d5.tar.xz |
do similar changes to unused checksManager
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Monitoring/ChecksManager.cs | 45 | ||||
-rw-r--r-- | OpenSim/Framework/Monitoring/StatsManager.cs | 3 |
2 files changed, 21 insertions, 27 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 | } |
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index c0be87b..6277d44 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs | |||
@@ -363,9 +363,6 @@ namespace OpenSim.Framework.Monitoring | |||
363 | if (TryGetStatParents(stat, out category, out container)) | 363 | if (TryGetStatParents(stat, out category, out container)) |
364 | return false; | 364 | return false; |
365 | 365 | ||
366 | // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed. | ||
367 | // This means that we don't need to lock or copy them on iteration, which will be a much more | ||
368 | // common operation after startup. | ||
369 | if (container == null) | 366 | if (container == null) |
370 | container = new SortedDictionary<string, Stat>(); | 367 | container = new SortedDictionary<string, Stat>(); |
371 | 368 | ||