Skip to content

Commit

Permalink
Skip freezing already-frozen objects
Browse files Browse the repository at this point in the history
Re-freezing of a frozen object should be avoided. It is defensive
but inefficient.

(cherry picked from commit f389d5c)
  • Loading branch information
mederly committed Nov 22, 2023
1 parent b8f1ea7 commit 8cc04e0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ public abstract class AbstractFreezable implements Freezable {

@Override
public final void freeze() {
performFreeze();
this.frozen = true;
if (!frozen) {
performFreeze();
this.frozen = true;
}
}

protected void freeze(Freezable child) {
Expand Down

0 comments on commit 8cc04e0

Please sign in to comment.