SOLR-9030: Added a code comment as to why we use Integer.MAX_VALUE instead of -1

This commit is contained in:
Shalin Shekhar Mangar 2016-05-05 05:18:22 +05:30
parent c2662f24ac
commit 827573b1a7
1 changed files with 1 additions and 0 deletions

View File

@ -66,6 +66,7 @@ public class DocCollection extends ZkNodeProps {
*/ */
public DocCollection(String name, Map<String, Slice> slices, Map<String, Object> props, DocRouter router, int zkVersion, String znode) { public DocCollection(String name, Map<String, Slice> slices, Map<String, Object> props, DocRouter router, int zkVersion, String znode) {
super(props==null ? props = new HashMap<>() : props); super(props==null ? props = new HashMap<>() : props);
// -1 means any version in ZK CAS, so we choose Integer.MAX_VALUE instead to avoid accidental overwrites
this.znodeVersion = zkVersion == -1 ? Integer.MAX_VALUE : zkVersion; this.znodeVersion = zkVersion == -1 ? Integer.MAX_VALUE : zkVersion;
this.name = name; this.name = name;