roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [13/16] roller git commit: ROL-2101 Thread unsafe use of HashMap for cached mappings exist
Date Sat, 28 Jan 2017 22:22:47 GMT
ROL-2101 Thread unsafe use of HashMap for cached mappings exist


Project: http://git-wip-us.apache.org/repos/asf/roller/repo
Commit: http://git-wip-us.apache.org/repos/asf/roller/commit/f95b8bef
Tree: http://git-wip-us.apache.org/repos/asf/roller/tree/f95b8bef
Diff: http://git-wip-us.apache.org/repos/asf/roller/diff/f95b8bef

Branch: refs/heads/bootstrap-ui
Commit: f95b8bef05fccbc20cda6458df8ae3a2ef22bf2f
Parents: 11f322d
Author: Kohei Nozaki <kohei@apache.org>
Authored: Sun Oct 23 16:22:24 2016 +0900
Committer: Kohei Nozaki <kohei@apache.org>
Committed: Sun Oct 23 16:22:24 2016 +0900

----------------------------------------------------------------------
 .../apache/roller/weblogger/business/jpa/JPAUserManagerImpl.java  | 3 ++-
 .../roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java  | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/roller/blob/f95b8bef/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAUserManagerImpl.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAUserManagerImpl.java
b/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAUserManagerImpl.java
index 4da8842..d684095 100644
--- a/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAUserManagerImpl.java
+++ b/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAUserManagerImpl.java
@@ -27,6 +27,7 @@ import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.UserManager;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -49,7 +50,7 @@ public class JPAUserManagerImpl implements UserManager {
     private final JPAPersistenceStrategy strategy;
     
     // cached mapping of userNames -> userIds
-    private Map<String, String> userNameToIdMap = new HashMap<String, String>();
+    private Map<String, String> userNameToIdMap = Collections.synchronizedMap(new HashMap<String,
String>());
     
 
     @com.google.inject.Inject

http://git-wip-us.apache.org/repos/asf/roller/blob/f95b8bef/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
b/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
index 70945a1..5035f93 100644
--- a/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
+++ b/app/src/main/java/org/apache/roller/weblogger/business/jpa/JPAWeblogEntryManagerImpl.java
@@ -68,7 +68,7 @@ public class JPAWeblogEntryManagerImpl implements WeblogEntryManager {
     private final JPAPersistenceStrategy strategy;
     
     // cached mapping of entryAnchors -> entryIds
-    private Map<String, String> entryAnchorToIdMap = new HashMap<String, String>();
+    private Map<String, String> entryAnchorToIdMap = Collections.synchronizedMap(new
HashMap<String, String>());
     
     private static final Comparator<TagStat> TAG_STAT_NAME_COMPARATOR = new TagStatComparator();
     


Mime
View raw message