public void updated()

in tx-control-providers/tx-control-provider-common/src/main/java/org/apache/aries/tx/control/resource/common/impl/ConfigurationDefinedResourceFactory.java [48:92]


	public void updated(String pid, Dictionary<String, ?> properties) throws ConfigurationException {

		Map<String, Object> propsMap = new HashMap<>();

		Enumeration<String> keys = properties.keys();
		while (keys.hasMoreElements()) {
			String key = keys.nextElement();
			propsMap.put(key, properties.get(key));
		}

		try {
			LifecycleAware existing = managedInstances.get(pid);
			
			LifecycleAware cdr;
			if(existing != null) {
				if(existing.update(propsMap)) {
					LOG.debug("The Configuration driven resource with pid {} updated successfully", pid);
					return;
				}
				closeCDR(pid, existing);
				
				cdr = getConfigurationDrivenResource(context, pid, propsMap);
				if(!managedInstances.replace(pid, existing, cdr)) {
					// We lost this race
					return;
				}
			} else {
				cdr = getConfigurationDrivenResource(context, pid, propsMap);
				if(managedInstances.putIfAbsent(pid, cdr) != null) {
					// We lost this race
					return;
				}
			}
			
			cdr.start();
		} catch (Exception e) {
			LOG.error("The configuration driven resource for pid {} encountered a failure", pid, e);
			
			if(e instanceof ConfigurationException) {
				throw (ConfigurationException) e;
			} else {
				throw new ConfigurationException(null, "A failure occured configuring the resource for pid " + pid, e);
			}
		}
	}