Skip to content

Commit

Permalink
chore: Synchronize around local reference to collection instead of sy…
Browse files Browse the repository at this point in the history
…nchronizing on the getter result directly (#17250)

Signed-off-by: Tim Farber-Newman <[email protected]>
  • Loading branch information
timfn-hg authored Jan 8, 2025
1 parent c26a5a4 commit 400c173
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016-2024 Hedera Hashgraph, LLC
* Copyright (C) 2016-2025 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,10 +20,12 @@
import static com.swirlds.platform.gui.internal.BrowserWindowManager.getPlatforms;

import com.hedera.hapi.node.state.roster.RosterEntry;
import com.swirlds.platform.SwirldsPlatform;
import com.swirlds.platform.gui.GuiUtils;
import com.swirlds.platform.gui.components.PrePaintableJPanel;
import com.swirlds.platform.roster.RosterUtils;
import com.swirlds.platform.system.Platform;
import java.util.Collection;
import javax.swing.JTextArea;

/**
Expand Down Expand Up @@ -51,8 +53,10 @@ public void prePaint() {
}
redoWindow = false;
String s = "";
synchronized (getPlatforms()) {
for (final Platform p : getPlatforms()) {
final Collection<SwirldsPlatform> platforms = getPlatforms();

synchronized (platforms) {
for (final Platform p : platforms) {
final RosterEntry entry =
RosterUtils.getRosterEntry(p.getRoster(), p.getSelfId().id());
final String name = RosterUtils.formatNodeName(entry.nodeId());
Expand Down

0 comments on commit 400c173

Please sign in to comment.