Reamer commented on a change in pull request #4263:
URL: https://github.com/apache/zeppelin/pull/4263#discussion_r793335383



##########
File path: zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
##########
@@ -279,22 +284,36 @@ public void setDefaultInterpreterGroup(String 
defaultInterpreterGroup) {
     this.defaultInterpreterGroup = defaultInterpreterGroup;
   }
 
-  public Map<String, Object> getNoteParams() {
-    return noteParams;
+  public ConcurrentHashMap<String, Object> getNoteParams() {
+    if (noteParams == null) {
+      return new ConcurrentHashMap<>();
+    }
+    return new ConcurrentHashMap<>(noteParams);
   }
 
   public void setNoteParams(Map<String, Object> noteParams) {
     this.noteParams = noteParams;
   }
 
-  public Map<String, Input> getNoteForms() {
-    return noteForms;
+  public void removeNoteParam(String key) {
+    noteParams.remove(key);
+  }
+
+  public ConcurrentHashMap<String, Input> getNoteForms() {
+    if (noteForms == null) {
+      return new ConcurrentHashMap<>();
+    }
+    return new ConcurrentHashMap<>(noteForms);

Review comment:
       Why return a new ConcurrentHashMap?
   I don't know if returning an Collections.unmodifiableMap might be a good 
approach here.
   This [code part 
](https://github.com/apache/zeppelin/blob/master/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java#L450-L455)
 should be the only place where the map is edited from another class. Here qw 
could force the class to create a new map to work on and then communicate it to 
the Note.




-- 
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: dev-unsubscr...@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to