Skip to content

Commit

Permalink
[server][router] Removing unneeded Optional to reduce memory allocati…
Browse files Browse the repository at this point in the history
…on (#796)
  • Loading branch information
alex-dubrouski authored Dec 12, 2023
1 parent a91cabe commit b54fbb9
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;

Expand Down Expand Up @@ -231,7 +230,10 @@ static AttributeMap getAttibuteMap(HttpMessage httpMessage) {
}

AttributeMap attributeMap() {
return Optional.ofNullable(_attributes).orElseGet(() -> _attributes = new DefaultAttributeMap());
if (_attributes == null) {
_attributes = new DefaultAttributeMap();
}
return _attributes;
}

@SuppressWarnings("unchecked")
Expand Down

0 comments on commit b54fbb9

Please sign in to comment.