class MultiAttributeCollection extends MultiAttributeProvider implements AttributeCollection {

	@Override
	public Attribute setAttributeType(String name, AttributeType type) throws AttributeException {
		final boolean b = this.runProviderEvents.getAndSet(false);
		try {
			final ManyValueAttributeValue oldValue = new ManyValueAttributeValue();
			final ManyValueAttributeValue attr = new ManyValueAttributeValue();
			Attribute a;
			boolean changed = false;
			for (final AttributeProvider c : containers()) {
				assign(oldValue, c.getAttribute(name));
				if (c instanceof AttributeCollection) {
					a = ((AttributeCollection) c).setAttributeType(name, type);
					assign(attr, a);
					if (a != null) {
						changed = true;
					}
				}
			}
			final AttributeValue cValue = canonize(attr);
			if (changed) {
				final AttributeValue oValue = canonize(oldValue);
				this.cache.put(name, cValue);
				fireAttributeChange(new AttributeChangeEvent(this, Type.VALUE_UPDATE, name, oValue, name, cValue));
			}
			return new AttributeImpl(name, cValue);
		} finally {
			this.runProviderEvents.set(b);
		}
	}

}