From 44c8fc867ecb65daeddc5aa121ccb4baad16007d Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Fri, 5 Oct 2012 17:26:44 +0200 Subject: Fixed property validations, added C# metrics test --- java/src/IceInternal/MetricsMap.java | 38 ++++++++---------------------------- 1 file changed, 8 insertions(+), 30 deletions(-) (limited to 'java/src/IceInternal/MetricsMap.java') diff --git a/java/src/IceInternal/MetricsMap.java b/java/src/IceInternal/MetricsMap.java index d1efd1d4bb7..071fea6d326 100644 --- a/java/src/IceInternal/MetricsMap.java +++ b/java/src/IceInternal/MetricsMap.java @@ -11,14 +11,6 @@ package IceInternal; public class MetricsMap { - final private String[] mapSuffixes = - { - "GroupBy", - "Accept.*", - "Reject.*", - "RetainDetached", - }; - public class Entry implements Comparable { Entry(T obj) @@ -202,6 +194,7 @@ public class MetricsMap MetricsMap(String mapPrefix, Class cl, Ice.Properties props, java.util.Map> subMaps) { + MetricsAdminI.validateProperties(mapPrefix, props); _properties = props.getPropertiesForPrefix(mapPrefix); _retain = props.getPropertyAsIntWithDefault(mapPrefix + "RetainDetached", 10); @@ -276,7 +269,6 @@ public class MetricsMap _subMaps.put(e.getKey(), e.getValue().createCloneFactory(subMapPrefix, props)); } - validateProperties(mapPrefix, props, subMapNames); } else { @@ -296,25 +288,6 @@ public class MetricsMap _subMaps = map._subMaps; } - private void - validateProperties(String prefix, Ice.Properties props, java.util.Collection subMaps) - { - if(subMaps.isEmpty()) - { - MetricsAdminI.validateProperties(prefix, props, mapSuffixes); - return; - } - - java.util.List suffixes = new java.util.ArrayList(java.util.Arrays.asList(mapSuffixes)); - for(String s : subMaps) - { - String suffix = "Map." + s + "."; - MetricsAdminI.validateProperties(prefix + suffix, props, mapSuffixes); - suffixes.add(suffix + '*'); - } - MetricsAdminI.validateProperties(prefix, props, suffixes.toArray(new String[suffixes.size()])); - } - java.util.Map getProperties() { @@ -324,6 +297,11 @@ public class MetricsMap synchronized IceMX.Metrics[] getMetrics() { + if(_objects.isEmpty()) + { + return null; + } + IceMX.Metrics[] metrics = new IceMX.Metrics[_objects.size()]; int i = 0; for(Entry e : _objects.values()) @@ -388,10 +366,10 @@ public class MetricsMap return null; } } - + for(java.util.Map.Entry e : _reject.entrySet()) { - if(match(e.getKey(), e.getValue(), helper, false)) + if(match(e.getKey(), e.getValue(), helper, true)) { return null; } -- cgit v1.2.3