@Test public void testMutatePrefixMap() { TestConfiguration tc = new TestConfiguration(); tc.set(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "a1", "325"); tc.set(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "a2", "asg34"); Map<String,String> pm1 = tc.getAllPropertiesWithPrefix(Property.TABLE_ARBITRARY_PROP_PREFIX); Map<String,String> expected1 = new HashMap<>(); expected1.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "a1", "325"); expected1.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "a2", "asg34"); assertEquals(expected1, pm1); assertThrows(UnsupportedOperationException.class, () -> pm1.put("k9", "v3")); }
public Map<String,String> getAllPropertiesWithPrefix(Property property) { checkType(property, PropertyType.PREFIX); PrefixProps prefixProps = cachedPrefixProps.get(property); if (prefixProps == null || prefixProps.updateCount != getUpdateCount()) { prefixCacheUpdateLock.lock(); try { long updateCount = getUpdateCount(); prefixProps = cachedPrefixProps.get(property); if (prefixProps == null || prefixProps.updateCount != updateCount) { Map<String,String> propMap = new HashMap<>(); getProperties(propMap, key -> key.startsWith(property.getKey())); propMap = Map.copyOf(propMap); EnumMap<Property,PrefixProps> localPrefixes = new EnumMap<>(Property.class); localPrefixes.putAll(cachedPrefixProps); prefixProps = new PrefixProps(propMap, updateCount); localPrefixes.put(property, prefixProps); cachedPrefixProps = localPrefixes; } } finally { prefixCacheUpdateLock.unlock(); } } return prefixProps.props; }
AccumuloConfiguration implements Iterable<Entry<String,String>> { public Map<String,String> getAllPropertiesWithPrefix(Property property) { checkType(property, PropertyType.PREFIX); PrefixProps prefixProps = cachedPrefixProps.get(property); if (prefixProps == null || prefixProps.updateCount != getUpdateCount()) { prefixCacheUpdateLock.lock(); try { long updateCount = getUpdateCount(); prefixProps = cachedPrefixProps.get(property); if (prefixProps == null || prefixProps.updateCount != updateCount) { Map<String,String> propMap = new HashMap<>(); getProperties(propMap, key -> key.startsWith(property.getKey())); propMap = Map.copyOf(propMap); EnumMap<Property,PrefixProps> localPrefixes = new EnumMap<>(Property.class); localPrefixes.putAll(cachedPrefixProps); prefixProps = new PrefixProps(propMap, updateCount); localPrefixes.put(property, prefixProps); cachedPrefixProps = localPrefixes; } } finally { prefixCacheUpdateLock.unlock(); } } return prefixProps.props; } }
AccumuloConfiguration implements Iterable<Entry<String,String>> { public Map<String,String> getAllPropertiesWithPrefix(Property property) { checkType(property, PropertyType.PREFIX); PrefixProps prefixProps = cachedPrefixProps.get(property); if (prefixProps == null || prefixProps.updateCount != getUpdateCount()) { prefixCacheUpdateLock.lock(); try { long updateCount = getUpdateCount(); prefixProps = cachedPrefixProps.get(property); if (prefixProps == null || prefixProps.updateCount != updateCount) { Map<String,String> propMap = new HashMap<>(); getProperties(propMap, key -> key.startsWith(property.getKey())); propMap = Map.copyOf(propMap); EnumMap<Property,PrefixProps> localPrefixes = new EnumMap<>(Property.class); localPrefixes.putAll(cachedPrefixProps); prefixProps = new PrefixProps(propMap, updateCount); localPrefixes.put(property, prefixProps); cachedPrefixProps = localPrefixes; } } finally { prefixCacheUpdateLock.unlock(); } } return prefixProps.props; }  }
AccumuloConfiguration implements Iterable<Entry<String,String>> { public Map<String,String> getAllPropertiesWithPrefix(Property property) { checkType(property, PropertyType.PREFIX); PrefixProps prefixProps = cachedPrefixProps.get(property); if (prefixProps == null || prefixProps.updateCount != getUpdateCount()) { prefixCacheUpdateLock.lock(); try { long updateCount = getUpdateCount(); prefixProps = cachedPrefixProps.get(property); if (prefixProps == null || prefixProps.updateCount != updateCount) { Map<String,String> propMap = new HashMap<>(); getProperties(propMap, key -> key.startsWith(property.getKey())); propMap = Map.copyOf(propMap); EnumMap<Property,PrefixProps> localPrefixes = new EnumMap<>(Property.class); localPrefixes.putAll(cachedPrefixProps); prefixProps = new PrefixProps(propMap, updateCount); localPrefixes.put(property, prefixProps); cachedPrefixProps = localPrefixes; } } finally { prefixCacheUpdateLock.unlock(); } } return prefixProps.props; }  String get(String property); abstract String get(Property property); Property resolve(Property property, Property deprecatedProperty); abstract void getProperties(Map<String,String> props, Predicate<String> filter); @Override Iterator<Entry<String,String>> iterator(); long getUpdateCount(); Map<String,String> getAllPropertiesWithPrefix(Property property); Map<String,String> getAllPropertiesWithPrefixStripped(Property prefix); long getAsBytes(Property property); long getTimeInMillis(Property property); boolean getBoolean(Property property); double getFraction(Property property); int[] getPort(Property property); int getCount(Property property); String getPath(Property property); int getMaxFilesPerTablet(); boolean isPropertySet(Property prop, boolean cacheAndWatch); Deriver<T> newDeriver(Function<AccumuloConfiguration,T> converter); Collection<ScanExecutorConfig> getScanExecutors(); void invalidateCache(); }
AccumuloConfiguration implements Iterable<Entry<String,String>> { public Map<String,String> getAllPropertiesWithPrefix(Property property) { checkType(property, PropertyType.PREFIX); PrefixProps prefixProps = cachedPrefixProps.get(property); if (prefixProps == null || prefixProps.updateCount != getUpdateCount()) { prefixCacheUpdateLock.lock(); try { long updateCount = getUpdateCount(); prefixProps = cachedPrefixProps.get(property); if (prefixProps == null || prefixProps.updateCount != updateCount) { Map<String,String> propMap = new HashMap<>(); getProperties(propMap, key -> key.startsWith(property.getKey())); propMap = Map.copyOf(propMap); EnumMap<Property,PrefixProps> localPrefixes = new EnumMap<>(Property.class); localPrefixes.putAll(cachedPrefixProps); prefixProps = new PrefixProps(propMap, updateCount); localPrefixes.put(property, prefixProps); cachedPrefixProps = localPrefixes; } } finally { prefixCacheUpdateLock.unlock(); } } return prefixProps.props; }  String get(String property); abstract String get(Property property); Property resolve(Property property, Property deprecatedProperty); abstract void getProperties(Map<String,String> props, Predicate<String> filter); @Override Iterator<Entry<String,String>> iterator(); long getUpdateCount(); Map<String,String> getAllPropertiesWithPrefix(Property property); Map<String,String> getAllPropertiesWithPrefixStripped(Property prefix); long getAsBytes(Property property); long getTimeInMillis(Property property); boolean getBoolean(Property property); double getFraction(Property property); int[] getPort(Property property); int getCount(Property property); String getPath(Property property); int getMaxFilesPerTablet(); boolean isPropertySet(Property prop, boolean cacheAndWatch); Deriver<T> newDeriver(Function<AccumuloConfiguration,T> converter); Collection<ScanExecutorConfig> getScanExecutors(); void invalidateCache();  }