commit | d48a4ea714b34064d9ce153351c613dd59f18495 | [log] [tgz] |
---|---|---|
author | Jacek Centkowski <geminica.programs@gmail.com> | Wed Apr 26 12:03:45 2023 +0200 |
committer | Jacek Centkowski <geminica.programs@gmail.com> | Fri May 26 10:47:50 2023 +0200 |
tree | 00b968fb82f0fe30a34387d29cb6d53e91f06901 | |
parent | a740d777b63798c0429b3bd611fff85308dcdbac [diff] |
Optimize the memory footprint for PathOwners cache Introduce the EMPTY PathOwnersEntry instance that is returned in case when OWNERS path is examined but no file is present. Bug: Issue 16830 Change-Id: Id5c4fbb382279962a02755a24287aeb7088cb972
diff --git a/owners-common/src/main/java/com/googlesource/gerrit/owners/common/PathOwners.java b/owners-common/src/main/java/com/googlesource/gerrit/owners/common/PathOwners.java index df398e3..ab3a7f1 100644 --- a/owners-common/src/main/java/com/googlesource/gerrit/owners/common/PathOwners.java +++ b/owners-common/src/main/java/com/googlesource/gerrit/owners/common/PathOwners.java
@@ -301,7 +301,7 @@ Collections.emptySet(), Collections.emptySet(), Collections.emptySet())) - .orElse(new PathOwnersEntry())); + .orElse(PathOwnersEntry.EMPTY)); } private void processMatcherPerPath(
diff --git a/owners-common/src/main/java/com/googlesource/gerrit/owners/common/PathOwnersEntry.java b/owners-common/src/main/java/com/googlesource/gerrit/owners/common/PathOwnersEntry.java index 1fbcc80..1ede8a6 100644 --- a/owners-common/src/main/java/com/googlesource/gerrit/owners/common/PathOwnersEntry.java +++ b/owners-common/src/main/java/com/googlesource/gerrit/owners/common/PathOwnersEntry.java
@@ -32,6 +32,8 @@ * <p>Used internally by PathOwners to represent and compute the owners at a specific path. */ class PathOwnersEntry { + static final PathOwnersEntry EMPTY = new PathOwnersEntry(); + private final boolean inherited; private Optional<LabelDefinition> label; private Set<Account.Id> owners = Sets.newHashSet();