You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by pd...@apache.org on 2023/03/22 16:25:08 UTC
[zeppelin] branch master updated: [ZEPPELIN-5885] Solve the concurrency problem caused by multiple concurrent calls to note clone (#4563)
This is an automated email from the ASF dual-hosted git repository.
pdallig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push:
new 5d102f5289 [ZEPPELIN-5885] Solve the concurrency problem caused by multiple concurrent calls to note clone (#4563)
5d102f5289 is described below
commit 5d102f528902306a8172a7c608072789f15981f4
Author: qinbo12 <34...@users.noreply.github.com>
AuthorDate: Thu Mar 23 00:24:55 2023 +0800
[ZEPPELIN-5885] Solve the concurrency problem caused by multiple concurrent calls to note clone (#4563)
---
.../java/org/apache/zeppelin/notebook/AuthorizationService.java | 6 +++---
.../apache/zeppelin/notebook/NotebookAuthorizationInfoSaving.java | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/AuthorizationService.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/AuthorizationService.java
index 2b50ec01a5..d8fb3b798e 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/AuthorizationService.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/AuthorizationService.java
@@ -32,10 +32,10 @@ import org.slf4j.LoggerFactory;
import javax.inject.Inject;
import java.io.IOException;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
/**
* This class is responsible for maintain notes authorization info. And provide api for
@@ -50,10 +50,10 @@ public class AuthorizationService implements ClusterEventListener {
private ConfigStorage configStorage;
// contains roles for each user (username --> roles)
- private Map<String, Set<String>> userRoles = new HashMap<>();
+ private Map<String, Set<String>> userRoles = new ConcurrentHashMap<>();
// cached note permission info. (noteId --> NoteAuth)
- private Map<String, NoteAuth> notesAuth = new HashMap<>();
+ private Map<String, NoteAuth> notesAuth = new ConcurrentHashMap<>();
@Inject
public AuthorizationService(NoteManager noteManager, ZeppelinConfiguration conf) {
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NotebookAuthorizationInfoSaving.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NotebookAuthorizationInfoSaving.java
index 6440fa4a97..75dc09b720 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NotebookAuthorizationInfoSaving.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NotebookAuthorizationInfoSaving.java
@@ -21,9 +21,9 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.apache.zeppelin.common.JsonSerializable;
-import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
/**
* Only used for saving NotebookAuthorization info
@@ -35,7 +35,7 @@ public class NotebookAuthorizationInfoSaving implements JsonSerializable {
private final Map<String, Map<String, Set<String>>> authInfo;
public NotebookAuthorizationInfoSaving(Map<String, NoteAuth> notesAuth) {
- this.authInfo = new HashMap<>();
+ this.authInfo = new ConcurrentHashMap<>();
for (Map.Entry<String, NoteAuth> entry : notesAuth.entrySet()) {
this.authInfo.put(entry.getKey(), entry.getValue().toMap());
}