1616package software .amazon .awssdk .core .interceptor ;
1717
1818import java .util .Collections ;
19- import java .util .HashMap ;
19+ import java .util .IdentityHashMap ;
2020import java .util .Map ;
2121import java .util .Optional ;
2222import software .amazon .awssdk .annotations .NotThreadSafe ;
@@ -38,11 +38,11 @@ public class ExecutionAttributes implements ToCopyableBuilder<ExecutionAttribute
3838 private final Map <ExecutionAttribute <?>, Object > attributes ;
3939
4040 public ExecutionAttributes () {
41- this .attributes = new HashMap <>(32 );
41+ this .attributes = new IdentityHashMap <>(64 );
4242 }
4343
4444 protected ExecutionAttributes (Map <? extends ExecutionAttribute <?>, ?> attributes ) {
45- this .attributes = new HashMap <>(attributes );
45+ this .attributes = new IdentityHashMap <>(attributes );
4646 }
4747
4848 /**
@@ -88,7 +88,7 @@ public <U> ExecutionAttributes putAttributeIfAbsent(ExecutionAttribute<U> attrib
8888 * Merge attributes of a higher precedence into the current lower precedence collection.
8989 */
9090 public ExecutionAttributes merge (ExecutionAttributes lowerPrecedenceExecutionAttributes ) {
91- Map <ExecutionAttribute <?>, Object > copiedAttributes = new HashMap <>(this .attributes );
91+ Map <ExecutionAttribute <?>, Object > copiedAttributes = new IdentityHashMap <>(this .attributes );
9292 lowerPrecedenceExecutionAttributes .getAttributes ().forEach (copiedAttributes ::putIfAbsent );
9393 return new ExecutionAttributes (copiedAttributes );
9494 }
@@ -167,7 +167,7 @@ public <U> ExecutionAttributes putAttributeIfAbsent(ExecutionAttribute<U> attrib
167167 * copy() if it's because of {@link #unmodifiableExecutionAttributes(ExecutionAttributes)}.
168168 */
169169 public static final class Builder implements CopyableBuilder <ExecutionAttributes .Builder , ExecutionAttributes > {
170- private final Map <ExecutionAttribute <?>, Object > executionAttributes = new HashMap <>(32 );
170+ private final Map <ExecutionAttribute <?>, Object > executionAttributes = new IdentityHashMap <>(64 );
171171
172172 private Builder () {
173173 }
0 commit comments