Skip to content

Commit fb5152d

Browse files
committed
feat(context): Reuse EmptyContext instance on deflation
1 parent 001b500 commit fb5152d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/context/src/main/java/datadog/context/SingletonContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public <V> Context with(ContextKey<V> secondKey, @Nullable V secondValue) {
3232
int secondIndex = secondKey.index;
3333
if (this.index == secondIndex) {
3434
return secondValue == null
35-
? new EmptyContext()
35+
? EmptyContext.INSTANCE
3636
: new SingletonContext(this.index, secondValue);
3737
} else {
3838
Object[] store = new Object[max(this.index, secondIndex) + 1];

0 commit comments

Comments
 (0)