richardstartin commented on code in PR #2072:
URL: https://github.com/apache/helix/pull/2072#discussion_r861163785


##########
helix-core/src/main/java/org/apache/helix/HelixProperty.java:
##########
@@ -156,25 +156,50 @@ public String toString() {
    * @param id
    */
   public HelixProperty(String id) {
-    this(new ZNRecord(id), id);
+    this(new ZNRecord(id), id, false);
   }
 
   /**
    * Initialize the property with an existing ZNRecord
-   * @param record
+   * @param record a deep copy of the record is made, updates to this record 
will not be reflected
+   *               by the HelixProperty
    */
   public HelixProperty(ZNRecord record) {
-    this(record, record.getId());
+    this(record, true);

Review Comment:
   @junkaixue default value true here because it came from the caller.



##########
helix-core/src/main/java/org/apache/helix/HelixProperty.java:
##########
@@ -156,25 +156,50 @@ public String toString() {
    * @param id
    */
   public HelixProperty(String id) {
-    this(new ZNRecord(id), id);
+    this(new ZNRecord(id), id, false);
   }
 
   /**
    * Initialize the property with an existing ZNRecord
-   * @param record
+   * @param record a deep copy of the record is made, updates to this record 
will not be reflected
+   *               by the HelixProperty
    */
   public HelixProperty(ZNRecord record) {
-    this(record, record.getId());
+    this(record, true);
   }
 
   /**
-   * Initialize the property with an existing ZNRecord with new record id
+   * Initialize the property with an existing ZNRecord
    * @param record
+   * @param deepCopyRecord set to true to make a copy of the ZNRecord, false 
otherwise
+   */
+  public HelixProperty(ZNRecord record, boolean deepCopyRecord) {
+    this(record, record.getId(), deepCopyRecord);
+  }
+
+  /**
+   * Initialize the property with an existing ZNRecord with new record id
+   * @param record a deep copy of the record is made, updates to this record 
will not be reflected by the HelixProperty
    * @param id
    */
   public HelixProperty(ZNRecord record, String id) {
-    _record = (record instanceof SessionAwareZNRecord) ? new 
SessionAwareZNRecord(record, id)
-        : new ZNRecord(record, id);
+    this(record, id, true);

Review Comment:
   @junkaixue default value true here because it came from the caller.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to