groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Use annotation `@ThreadSafe` to mark thread-safe caches
Date Sun, 18 Feb 2018 12:28:43 GMT
Repository: groovy
Updated Branches:
  refs/heads/master b09e08bf1 -> 427d2f256


Use annotation `@ThreadSafe` to mark thread-safe caches


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

Branch: refs/heads/master
Commit: 427d2f25654d3911cece1054597372d27be29f8d
Parents: b09e08b
Author: danielsun1106 <realbluesun@hotmail.com>
Authored: Sun Feb 18 20:28:38 2018 +0800
Committer: danielsun1106 <realbluesun@hotmail.com>
Committed: Sun Feb 18 20:28:38 2018 +0800

----------------------------------------------------------------------
 .../org/codehaus/groovy/runtime/memoize/ConcurrentCommonCache.java | 2 ++
 src/main/java/org/codehaus/groovy/runtime/memoize/LRUCache.java    | 2 ++
 2 files changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/427d2f25/src/main/java/org/codehaus/groovy/runtime/memoize/ConcurrentCommonCache.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/memoize/ConcurrentCommonCache.java
b/src/main/java/org/codehaus/groovy/runtime/memoize/ConcurrentCommonCache.java
index 8e090a9..f0a1e1c 100644
--- a/src/main/java/org/codehaus/groovy/runtime/memoize/ConcurrentCommonCache.java
+++ b/src/main/java/org/codehaus/groovy/runtime/memoize/ConcurrentCommonCache.java
@@ -18,6 +18,7 @@
  */
 package org.codehaus.groovy.runtime.memoize;
 
+import javax.annotation.concurrent.ThreadSafe;
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Map;
@@ -31,6 +32,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
  * @param <V> type of the values
  * @since 2.5.0
  */
+@ThreadSafe
 public class ConcurrentCommonCache<K, V> implements EvictableCache<K, V>, Serializable
{
     private static final long serialVersionUID = -7352338549333024936L;
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/427d2f25/src/main/java/org/codehaus/groovy/runtime/memoize/LRUCache.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/memoize/LRUCache.java b/src/main/java/org/codehaus/groovy/runtime/memoize/LRUCache.java
index 7565519..7d32561 100644
--- a/src/main/java/org/codehaus/groovy/runtime/memoize/LRUCache.java
+++ b/src/main/java/org/codehaus/groovy/runtime/memoize/LRUCache.java
@@ -20,6 +20,7 @@ package org.codehaus.groovy.runtime.memoize;
 
 import org.apache.groovy.util.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
 
+import javax.annotation.concurrent.ThreadSafe;
 import java.lang.ref.SoftReference;
 import java.util.Iterator;
 import java.util.Map;
@@ -31,6 +32,7 @@ import java.util.concurrent.ConcurrentMap;
  * @author Vaclav Pech
  * @author <a href="mailto:realbluesun@hotmail.com">Daniel.Sun</a>
  */
+@ThreadSafe
 public final class LRUCache<K, V> implements MemoizeCache<K, V> {
     private final ConcurrentMap<K, V> cache;
 


Mime
View raw message