Source:
<code>public void updated(Dictionary<String, ?> config) throws ConfigurationException { logger.debug("Configuration updated, config {}", config != null ? true : false); if (config != null) { Enumeration<String> keys = config.keys(); if (deviceConfigCache == null) { deviceConfigCache = new HashMap<String, DeviceConfig>(); } while (keys.hasMoreElements()) { String key = keys.nextElement(); if ("service.pid".equals(key)) { continue; } Matcher matcher = EXTRACT_CONFIG_PATTERN.matcher(key); if (!matcher.matches()) { <START> logger.debug("given config key '" + key <END> + "' does not follow the expected pattern '<id>.<host|port|serialPortName>'"); continue; } matcher.reset(); matcher.find(); String deviceId = matcher.group(1); DeviceConfig deviceConfig = deviceConfigCache.get(deviceId); if (deviceConfig == null) { deviceConfig = new DeviceConfig(deviceId); deviceConfigCache.put(deviceId, deviceConfig); } String configKey = matcher.group(2); String value = (String) config.get(key); if ("serialPortName".equals(configKey)) { deviceConfig.serialPortName = value; } else if ("host".equals(configKey)) { deviceConfig.host = value; } else if ("port".equals(configKey)) { deviceConfig.port = Integer.valueOf(value); } else { throw new ConfigurationException(configKey, "the given configKey '" + configKey + "' is unknown"); } } for (String device : deviceConfigCache.keySet()) { OnkyoConnection connection = deviceConfigCache.get(device).getConnection(); if (connection != null) { connection.openConnection(); connection.addEventListener(this); } } for (OnkyoBindingProvider provider : this.providers) { for (String itemName : provider.getItemNames()) { initializeItem(itemName); } } } }</code><technical_language>parameterized logging instead of string concatenation, this method generating garbage objects call</technical_language>

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { logger.debug("Configuration updated, config {}", config != null ? true : false); if (config != null) { Enumeration<String> keys = config.keys(); if (deviceConfigCache == null) { deviceConfigCache = new HashMap<String, DeviceConfig>(); } while (keys.hasMoreElements()) { String key = keys.nextElement(); if ("service.pid".equals(key)) { continue; } Matcher matcher = EXTRACT_CONFIG_PATTERN.matcher(key); if (!matcher.matches()) { logger.debug( "given config key '{}' does not follow the expected pattern '<id>.<host|port|serialPortName>'", key); continue; } matcher.reset(); matcher.find(); String deviceId = matcher.group(1); DeviceConfig deviceConfig = deviceConfigCache.get(deviceId); if (deviceConfig == null) { deviceConfig = new DeviceConfig(deviceId); deviceConfigCache.put(deviceId, deviceConfig); } String configKey = matcher.group(2); String value = (String) config.get(key); if ("serialPortName".equals(configKey)) { deviceConfig.serialPortName = value; } else if ("host".equals(configKey)) { deviceConfig.host = value; } else if ("port".equals(configKey)) { deviceConfig.port = Integer.valueOf(value); } else { throw new ConfigurationException(configKey, "the given configKey '" + configKey + "' is unknown"); } } for (String device : deviceConfigCache.keySet()) { OnkyoConnection connection = deviceConfigCache.get(device).getConnection(); if (connection != null) { connection.openConnection(); connection.addEventListener(this); } } for (OnkyoBindingProvider provider : this.providers) { for (String itemName : provider.getItemNames()) { initializeItem(itemName); } } } }