Fix semantic of DefaultAttribute impl on setIfAbsent
This commit is contained in:
parent
2d9cc9f63b
commit
2ad1451ce8
@ -51,12 +51,14 @@ public class DefaultAttributeMap implements AttributeMap {
|
||||
|
||||
@Override
|
||||
public T setIfAbsent(T value) {
|
||||
if (compareAndSet(null, value)) {
|
||||
return null;
|
||||
} else {
|
||||
return get();
|
||||
while (!compareAndSet(null, value)) {
|
||||
T old = get();
|
||||
if (old != null) {
|
||||
return old;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
|
Loading…
Reference in New Issue
Block a user