Skip to content

Commit 310d65a

Browse files
author
Andrey Ershov
committed
Move set copy from builder to constructor
1 parent 16c4884 commit 310d65a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationMetaData.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public CoordinationMetaData(long term, VotingConfiguration lastCommittedConfigur
8686
this.term = term;
8787
this.lastCommittedConfiguration = lastCommittedConfiguration;
8888
this.lastAcceptedConfiguration = lastAcceptedConfiguration;
89-
this.votingTombstones = votingTombstones;
89+
this.votingTombstones = Collections.unmodifiableSet(new HashSet<>(votingTombstones));
9090
}
9191

9292
public CoordinationMetaData(StreamInput in) throws IOException {
@@ -216,8 +216,7 @@ public Builder clearVotingTombstones() {
216216
}
217217

218218
public CoordinationMetaData build() {
219-
return new CoordinationMetaData(term, lastCommittedConfiguration, lastAcceptedConfiguration,
220-
Collections.unmodifiableSet(new HashSet<>(votingTombstones)));
219+
return new CoordinationMetaData(term, lastCommittedConfiguration, lastAcceptedConfiguration, votingTombstones);
221220
}
222221
}
223222

0 commit comments

Comments
 (0)