Fix semantic of DefaultAttribute impl on setIfAbsent

This commit is contained in:
Norman Maurer 2013-01-31 11:49:52 +01:00
parent 2d9cc9f63b
commit 2ad1451ce8

View File

@ -51,12 +51,14 @@ public class DefaultAttributeMap implements AttributeMap {
@Override @Override
public T setIfAbsent(T value) { public T setIfAbsent(T value) {
if (compareAndSet(null, value)) { while (!compareAndSet(null, value)) {
return null; T old = get();
} else { if (old != null) {
return get(); return old;
} }
} }
return null;
}
@Override @Override
public void remove() { public void remove() {