freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [1/2] incubator-freemarker git commit: Fixed MruCacheStorage concurrency bug introduced in FM3
Date Fri, 23 Jun 2017 19:04:53 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/3 492fa2085 -> e97f6ba21


Fixed MruCacheStorage concurrency bug introduced in FM3


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

Branch: refs/heads/3
Commit: d732b3c078dfe8308c66f37b853571df2b3c6963
Parents: 492fa20
Author: ddekany <ddekany@apache.org>
Authored: Fri Jun 23 21:03:43 2017 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Fri Jun 23 21:03:43 2017 +0200

----------------------------------------------------------------------
 .../freemarker/core/templateresolver/impl/MruCacheStorage.java | 6 +++---
 .../core/templateresolver/impl/SoftCacheStorage.java           | 2 +-
 .../core/templateresolver/impl/StrongCacheStorage.java         | 3 +--
 3 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d732b3c0/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/MruCacheStorage.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/MruCacheStorage.java
b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/MruCacheStorage.java
index f86e746..7d5e52b 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/MruCacheStorage.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/MruCacheStorage.java
@@ -86,7 +86,7 @@ public class MruCacheStorage implements CacheStorageWithGetSize {
     }
     
     @Override
-    public Object get(Object key) {
+    public synchronized Object get(Object key) {
         removeClearedReferences();
         MruEntry entry = (MruEntry) map.get(key);
         if (entry == null) {
@@ -102,7 +102,7 @@ public class MruCacheStorage implements CacheStorageWithGetSize {
     }
 
     @Override
-    public void put(Object key, Object value) {
+    public synchronized void put(Object key, Object value) {
         removeClearedReferences();
         MruEntry entry = (MruEntry) map.get(key);
         if (entry == null) {
@@ -116,7 +116,7 @@ public class MruCacheStorage implements CacheStorageWithGetSize {
     }
 
     @Override
-    public void remove(Object key) {
+    public synchronized void remove(Object key) {
         removeClearedReferences();
         removeInternal(key);
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d732b3c0/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/SoftCacheStorage.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/SoftCacheStorage.java
b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/SoftCacheStorage.java
index 2cbaf33..b276a9e 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/SoftCacheStorage.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/SoftCacheStorage.java
@@ -37,7 +37,7 @@ import org.apache.freemarker.core.templateresolver.CacheStorageWithGetSize;
  *
  * @see ExtendableBuilder#setTemplateCacheStorage(CacheStorage)
  */
-public class SoftCacheStorage implements CacheStorage, CacheStorageWithGetSize {
+public class SoftCacheStorage implements CacheStorageWithGetSize {
     
     private final ReferenceQueue queue = new ReferenceQueue();
     private final ConcurrentMap map;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/d732b3c0/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/StrongCacheStorage.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/StrongCacheStorage.java
b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/StrongCacheStorage.java
index bef7142..f99bd98 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/StrongCacheStorage.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/impl/StrongCacheStorage.java
@@ -24,7 +24,6 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
 import org.apache.freemarker.core.Configuration;
-import org.apache.freemarker.core.templateresolver.CacheStorage;
 import org.apache.freemarker.core.templateresolver.CacheStorageWithGetSize;
 
 /**
@@ -34,7 +33,7 @@ import org.apache.freemarker.core.templateresolver.CacheStorageWithGetSize;
  *
  * @see Configuration#getTemplateCacheStorage()
  */
-public class StrongCacheStorage implements CacheStorage, CacheStorageWithGetSize {
+public class StrongCacheStorage implements CacheStorageWithGetSize {
     
     private final ConcurrentMap map = new ConcurrentHashMap();
 


Mime
View raw message