Skip to content

Commit

Permalink
fix a case of unnecessary reentrant locking
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Jul 7, 2024
1 parent cdf5fc9 commit 0ac7a04
Showing 1 changed file with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,7 @@ private void choosePreferred() {
Platform preferred = null;
Preference highest = null;

List<Platform> availablePlatforms;
platformsLock.readLock().lock();

try {
availablePlatforms = getPlatforms();
} finally {
platformsLock.readLock().unlock();
}

for (Platform platform : availablePlatforms) {
for (Platform platform : getPlatforms()) {
Preference preference = platform.getCapabilities().get(capability);
if (preference != null && (highest == null || preference.isPreferredOver(highest))) {
preferred = platform;
Expand Down

0 comments on commit 0ac7a04

Please sign in to comment.