hchar 2005/01/24 02:33:22
Modified: sandbox/yajcache/src/org/apache/jcs/yajcache/util
BeanUtils.java ClassUtils.java SerializeUtils.java
sandbox/yajcache/src/org/apache/jcs/yajcache/core
CacheEntry.java CacheManager.java
CacheManagerUtils.java ICache.java ICacheSafe.java
SafeCacheManager.java
sandbox/yajcache/src/org/apache/jcs/yajcache/soft
KeyedSoftRef.java KeyedSoftRefCollector.java
SoftRefCache.java SoftRefCacheCleaner.java
SoftRefCacheSafe.java
Log:
annotate non-nullable
Revision Changes Path
1.2 +4 -2
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/util/BeanUtils.java
Index: BeanUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/util/BeanUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BeanUtils.java 22 Jan 2005 21:34:42 -0000 1.1
+++ BeanUtils.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -51,14 +51,16 @@
throw new RuntimeException(ex);
}
}
- public byte[] toXmlByteArray(Object bean) {
+ @TODO("Replace XMLEncoder with something fast. Maybe XStream ?")
+ public @NonNullable byte[] toXmlByteArray(@NonNullable Object bean) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
XMLEncoder out = new XMLEncoder(bos);
out.writeObject(bean);
out.close();
return bos.toByteArray();
}
- public Object fromXmlByteArray(byte[] bytes) {
+ @TODO("Replace XMLDecoder with something fast. Maybe XStream ?")
+ public @NonNullable Object fromXmlByteArray(@NonNullable byte[] bytes) {
if (debug)
log.debug(new String(bytes));
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
1.2 +2 -2
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/util/ClassUtils.java
Index: ClassUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/util/ClassUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ClassUtils.java 22 Jan 2005 21:34:42 -0000 1.1
+++ ClassUtils.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -31,7 +31,7 @@
* Returns true if instances of the given class is known to be
immutable;
* false if we don't know.
*/
- public boolean isImmutable(Class t) {
+ public boolean isImmutable(@NonNullable Class t) {
return t == String.class
|| t.isPrimitive()
|| t == Boolean.class
@@ -47,7 +47,7 @@
|| t.isEnum()
;
}
- public boolean isImmutable(Object obj) {
+ public boolean isImmutable(@NonNullable Object obj) {
return this.isImmutable(obj.getClass());
}
}
1.2 +1 -1
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/util/SerializeUtils.java
Index: SerializeUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/util/SerializeUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SerializeUtils.java 22 Jan 2005 21:34:42 -0000 1.1
+++ SerializeUtils.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -53,7 +53,7 @@
// deep clone.
return (V)SerializationUtils.clone(obj);
}
- private <A> A cloneArray(A a) {
+ private @NonNullable <A> A cloneArray(@NonNullable A a) {
int len = Array.getLength(a);
Object result = Array.newInstance(a.getClass().getComponentType(), len);
System.arraycopy(a, 0, result, 0, len);
1.2 +7 -7
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/core/CacheEntry.java
Index: CacheEntry.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/core/CacheEntry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CacheEntry.java 22 Jan 2005 21:34:09 -0000 1.1
+++ CacheEntry.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -27,23 +27,23 @@
*/
@CopyRightApache
public class CacheEntry<V> implements Map.Entry<String,V> {
- private final String key;
- private V value;
+ private @NonNullable final String key;
+ private @NonNullable V value;
/** Creates a new instance of CacheEntry */
- public CacheEntry(String key, V val) {
+ public CacheEntry(@NonNullable String key, @NonNullable V val) {
this.key = key;
this.value = val;
}
- public String getKey() {
+ public @NonNullable String getKey() {
return key;
}
- public V getValue() {
+ public @NonNullable V getValue() {
return value;
}
- public V setValue(V val) {
+ public V setValue(@NonNullable V val) {
V ret = this.value;
this.value = val;
return ret;
@@ -51,7 +51,7 @@
@Override public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
- @Override public String toString() {
+ @Override @NonNullable public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}
1.2 +5 -5
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/core/CacheManager.java
Index: CacheManager.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/core/CacheManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CacheManager.java 22 Jan 2005 21:34:09 -0000 1.1
+++ CacheManager.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -39,7 +39,7 @@
* incompatible value type.
*/
// @SuppressWarnings({"unchecked"})
- public <V> ICache<V> getCache(String name, Class<V> valueType)
+ public @NonNullable <V> ICache<V> getCache(@NonNullable String name,
@NonNullable Class<V> valueType)
{
ICache c = this.map.get(name);
@@ -52,13 +52,13 @@
/**
* Returns an existing cache for the specified name; or null if not
found.
*/
- public ICache getCache(String name) {
+ public ICache getCache(@NonNullable String name) {
return this.map.get(name);
}
/**
* Removes the specified cache, if it exists.
*/
- public ICache removeCache(String name) {
+ public ICache removeCache(@NonNullable String name) {
ICache c = this.map.remove(name);
if (c != null) {
@@ -73,7 +73,7 @@
* an existing cache created earlier by another thread.
*/
// @SuppressWarnings({"unchecked"})
- private <V> ICache<V> createCache(String name, Class<V> valueType) {
+ private @NonNullable <V> ICache<V> createCache(@NonNullable String name,
@NonNullable Class<V> valueType) {
ICache<V> c = new SoftRefCache<V>(name, valueType);
ICache old = this.map.putIfAbsent(name, c);
@@ -86,7 +86,7 @@
}
@TestOnly("Used solely to simluate a race condition during cache
creation ")
- <V> ICache<V> testCreateCacheRaceCondition(String name, Class<V>
valueType)
+ @NonNullable <V> ICache<V> testCreateCacheRaceCondition(@NonNullable
String name, @NonNullable Class<V> valueType)
{
return this.createCache(name, valueType);
}
1.2 +1 -1
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/core/CacheManagerUtils.java
Index: CacheManagerUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/core/CacheManagerUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CacheManagerUtils.java 22 Jan 2005 21:34:09 -0000 1.1
+++ CacheManagerUtils.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -24,7 +24,7 @@
enum CacheManagerUtils {
inst;
/** Checks the value type assignability of an existing cache. */
- void checkValueType(ICache c, Class<?> valueType) {
+ void checkValueType(@NonNullable ICache c, @NonNullable Class<?>
valueType) {
Class<?> cacheValueType = c.getValueType();
if (!cacheValueType.isAssignableFrom(valueType))
1.2 +2 -2
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/core/ICache.java
Index: ICache.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/core/ICache.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ICache.java 22 Jan 2005 21:34:09 -0000 1.1
+++ ICache.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -31,10 +31,10 @@
public interface ICache<V> extends Map<String,V> {
/** Returns the cache name. */
@ThreadSafety(ThreadSafetyType.IMMUTABLE)
- public String getName();
+ public @NonNullable String getName();
/** Returns the value type of the cached items. */
@ThreadSafety(ThreadSafetyType.IMMUTABLE)
- public Class<V> getValueType();
+ public @NonNullable Class<V> getValueType();
/** Returns the value cached for the specified key. */
@ThreadSafety(
value=ThreadSafetyType.SAFE,
1.2 +9 -9
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/core/ICacheSafe.java
Index: ICacheSafe.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/core/ICacheSafe.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ICacheSafe.java 22 Jan 2005 21:34:09 -0000 1.1
+++ ICacheSafe.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -35,7 +35,7 @@
note="The return value is guaranteed to be thread-safe"
+ " only if the return value type is Serializable."
)
- public V getCopy(String key);
+ public V getCopy(@NonNullable String key);
/**
* If the cache value is Serializable, puts a deep clone copy of
* the given value to the cache. Else, the behavior is the same as put.
@@ -45,7 +45,7 @@
note="The given value is guaranteed to be thread-safe"
+ " only if the value type is Serializable."
)
- public V putCopy(String key, V value);
+ public V putCopy(@NonNullable String key, @NonNullable V value);
/**
* If the cache value is Serializable, puts the deep clone copies of
* the given values to the cache. Else, the behavior is the same as
putAll.
@@ -56,7 +56,7 @@
note="The given values in the map is guaranteed to be thread-safe"
+ " only if the value type is Serializable."
)
- public void putAllCopies(Map<? extends String, ? extends V> map);
+ public void putAllCopies(@NonNullable Map<? extends String, ? extends V>
map);
/**
* Treats the cache value as a Java Bean and returns a deep clone copy of
* the cached value.
@@ -66,7 +66,7 @@
note="The return value is guaranteed to be thread-safe"
+ " only if the return value is a Java Bean."
)
- public V getBeanCopy(String key);
+ public V getBeanCopy(@NonNullable String key);
/**
* Treats the cache value as a Java Bean and puts a deep clone copy of
* the given value to the cache.
@@ -76,7 +76,7 @@
note="The given value is guaranteed to be thread-safe"
+ " only if the value is a Java Bean."
)
- public V putBeanCopy(String key, V value);
+ public V putBeanCopy(@NonNullable String key, @NonNullable V value);
/**
* Treats the cache value as a Java Bean and puts the deep clone copies
of
* the given values to the cache.
@@ -88,7 +88,7 @@
note="The given values in the map is guaranteed to be thread-safe"
+ " only if the values are Java Beans."
)
- public void putAllBeanCopies(Map<? extends String, ? extends V> map);
+ public void putAllBeanCopies(@NonNullable Map<? extends String, ?
extends V> map);
/**
* Treats the cache value as a Java Bean and returns a shallow clone
copy of
* the cached value.
@@ -100,7 +100,7 @@
note="The return value is guaranteed to be thread-safe"
+ " only if the return value is a JavaBean."
)
- public V getBeanClone(String key);
+ public V getBeanClone(@NonNullable String key);
/**
* Treats the cache value as a Java Bean and puts a shallow clone copy of
* the given value to the cache.
@@ -112,7 +112,7 @@
note="The given value is guaranteed to be thread-safe"
+ " only if the value is a Java Bean."
)
- public V putBeanClone(String key, V value);
+ public V putBeanClone(@NonNullable String key, @NonNullable V value);
/**
* Treats the cache value as a Java Bean and puts the shallow clone
copies of
* the given values to the cache.
@@ -126,5 +126,5 @@
note="The given values in the map is guaranteed to be thread-safe"
+ " only if the values are Java Beans."
)
- public void putAllBeanClones(Map<? extends String, ? extends V> map);
+ public void putAllBeanClones(@NonNullable Map<? extends String, ?
extends V> map);
}
1.2 +9 -7
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/core/SafeCacheManager.java
Index: SafeCacheManager.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/core/SafeCacheManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SafeCacheManager.java 22 Jan 2005 21:34:09 -0000 1.1
+++ SafeCacheManager.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -29,7 +29,7 @@
public enum SafeCacheManager {
inst;
// Cache name to Cache mapping.
- private final ConcurrentMap<String,ICacheSafe> map =
+ private final @NonNullable ConcurrentMap<String,ICacheSafe> map =
new ConcurrentHashMap<String, ICacheSafe>();
/**
* Returns the cache for the specified name and value type;
@@ -38,7 +38,7 @@
* @throws ClassCastException if the cache already exists for an
* incompatible value type.
*/
- public <V> ICacheSafe<V> getCache(String name, Class<V> valueType)
+ public @NonNullable <V> ICacheSafe<V> getCache(@NonNullable String name,
@NonNullable Class<V> valueType)
{
ICacheSafe c = this.map.get(name);
@@ -51,13 +51,13 @@
/**
* Returns an existing cache for the specified name; or null if not
found.
*/
- public ICacheSafe getCache(String name) {
+ public ICacheSafe getCache(@NonNullable String name) {
return this.map.get(name);
}
/**
* Removes the specified cache, if it exists.
*/
- public ICacheSafe removeCache(String name) {
+ public ICacheSafe removeCache(@NonNullable String name) {
ICacheSafe c = this.map.remove(name);
if (c != null) {
@@ -71,7 +71,9 @@
* @return either the cache created by the current thread, or
* an existing cache created earlier by another thread.
*/
- private <V> ICacheSafe<V> createCache(String name, Class<V> valueType) {
+ private @NonNullable <V> ICacheSafe<V> createCache(
+ @NonNullable String name, @NonNullable Class<V> valueType)
+ {
ICacheSafe c = new SoftRefCacheSafe<V>(name, valueType);
ICacheSafe old = this.map.putIfAbsent(name, c);
@@ -84,8 +86,8 @@
}
@TestOnly("Used soley to simluate a race condition during cache
creation")
- <V> ICacheSafe<V> testCreateCacheRaceCondition(
- String name, Class<V> valueType)
+ @NonNullable <V> ICacheSafe<V> testCreateCacheRaceCondition(
+ @NonNullable String name, @NonNullable Class<V> valueType)
{
return this.createCache(name, valueType);
}
1.2 +2 -2
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/KeyedSoftRef.java
Index: KeyedSoftRef.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/KeyedSoftRef.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- KeyedSoftRef.java 22 Jan 2005 21:34:26 -0000 1.1
+++ KeyedSoftRef.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -27,13 +27,13 @@
*/
@CopyRightApache
class KeyedSoftRef<T> extends SoftReference<T> {
- private final String key;
+ private final @NonNullable String key;
// KeyedSoftRef(String key, T value) {
// super(value);
// this.key = key;
// }
- KeyedSoftRef(String key, T value, ReferenceQueue<? super T> q) {
+ KeyedSoftRef(@NonNullable String key, @NonNullable T value,
ReferenceQueue<? super T> q) {
super(value, q);
this.key = key;
}
1.2 +5 -3
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/KeyedSoftRefCollector.java
Index: KeyedSoftRefCollector.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/KeyedSoftRefCollector.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- KeyedSoftRefCollector.java 22 Jan 2005 21:34:26 -0000 1.1
+++ KeyedSoftRefCollector.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -32,10 +32,12 @@
private static final boolean debug = true;
private Log log = debug ? LogFactory.getLog(this.getClass()) : null;
private volatile int count;
- private final ReferenceQueue<V> q;
- private final Map<String, KeyedSoftRef<V>> map;
+ private final @NonNullable ReferenceQueue<V> q;
+ private final @NonNullable Map<String, KeyedSoftRef<V>> map;
/** Creates a new instance of ReferenceQProcessor */
- KeyedSoftRefCollector(ReferenceQueue<V> q, Map<String, KeyedSoftRef<V>>
map) {
+ KeyedSoftRefCollector(
+ @NonNullable ReferenceQueue<V> q, @NonNullable Map<String,
KeyedSoftRef<V>> map)
+ {
this.q = q;
this.map = map;
}
1.2 +21 -20
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefCache.java
Index: SoftRefCache.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefCache.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SoftRefCache.java 22 Jan 2005 21:34:26 -0000 1.1
+++ SoftRefCache.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -41,11 +41,11 @@
public class SoftRefCache<V> implements ICache<V> {
private static final boolean debug = true;
private Log log = debug ? LogFactory.getLog(this.getClass()) : null;
- private final ReferenceQueue<V> refq = new ReferenceQueue<V>();
- private final String name;
- private final Class<V> valueType;
- private final Map<String, KeyedSoftRef<V>> map;
- private final KeyedSoftRefCollector<V> collector;
+ private final @NonNullable ReferenceQueue<V> refq = new
ReferenceQueue<V>();
+ private final @NonNullable String name;
+ private final @NonNullable Class<V> valueType;
+ private final @NonNullable Map<String, KeyedSoftRef<V>> map;
+ private final @NonNullable KeyedSoftRefCollector<V> collector;
public String getName() {
return this.name;
@@ -53,7 +53,7 @@
public Class<V> getValueType() {
return this.valueType;
}
- public SoftRefCache(String name, Class<V> valueType, int initialCapacity,
+ public SoftRefCache(@NonNullable String name, @NonNullable Class<V>
valueType, int initialCapacity,
float loadFactor, int concurrencyLevel)
{
map = new ConcurrentHashMap<String,KeyedSoftRef<V>>(initialCapacity,
loadFactor, concurrencyLevel);
@@ -61,14 +61,15 @@
this.name = name;
this.valueType = valueType;
}
- public SoftRefCache(String name, Class<V> valueType, int
initialCapacity) {
+ public SoftRefCache(@NonNullable String name, @NonNullable Class<V>
valueType, int initialCapacity)
+ {
map = new ConcurrentHashMap<String,KeyedSoftRef<V>>(initialCapacity);
collector = new KeyedSoftRefCollector<V>(refq, map);
this.name = name;
this.valueType = valueType;
}
- public SoftRefCache(String name, Class<V> valueType) {
+ public SoftRefCache(@NonNullable String name, @NonNullable Class<V>
valueType) {
map = new ConcurrentHashMap<String,KeyedSoftRef<V>>();
collector = new KeyedSoftRefCollector<V>(refq, map);
this.name = name;
@@ -88,7 +89,7 @@
// @tothink: SoftReference.get() doesn't seem to be thread-safe.
// But do we really want to synchronize upon invoking get() ?
// It's not thread-safe, but what's the worst consequence ?
- public V get(String key) {
+ public V get(@NonNullable String key) {
this.collector.run();
KeyedSoftRef<V> ref = map.get(key);
@@ -145,10 +146,10 @@
// return;
// }
- public V get(Object key) {
+ public V get(@NonNullable Object key) {
return key == null ? null : this.get(key.toString());
}
- public V put(String key, V value) {
+ public V put(@NonNullable String key, @NonNullable V value) {
this.collector.run();
KeyedSoftRef<V> oldRef = map.put(key, new KeyedSoftRef<V>(key,
value, refq));
@@ -168,14 +169,14 @@
value="Queue up a flush event for the key.",
details="This is useful for synchronizing caches in a cluster
environment."
)
- private void publishFlushKey(String key) {
+ private void publishFlushKey(@NonNullable String key) {
}
- public void putAll(Map<? extends String, ? extends V> map) {
+ public void putAll(@NonNullable Map<? extends String, ? extends V> map) {
for (final Map.Entry<? extends String, ? extends V> e :
map.entrySet())
this.put(e.getKey(), e.getValue());
}
- public V remove(String key) {
+ public V remove(@NonNullable String key) {
this.collector.run();
KeyedSoftRef<V> oldRef = map.remove(key);
@@ -186,18 +187,18 @@
oldRef.clear();
return ret;
}
- public V remove(Object key) {
+ public V remove(@NonNullable Object key) {
return key == null ? null : this.remove(key.toString());
}
public void clear() {
this.collector.run();
map.clear();
}
- public Set<String> keySet() {
+ public @NonNullable Set<String> keySet() {
this.collector.run();
return map.keySet();
}
- public Set<Map.Entry<String,V>> entrySet() {
+ public @NonNullable Set<Map.Entry<String,V>> entrySet() {
this.collector.run();
Set<Map.Entry<String,KeyedSoftRef<V>>> fromSet = map.entrySet();
Set<Map.Entry<String,V>> toSet = new HashSet<Map.Entry<String,V>>();
@@ -213,7 +214,7 @@
}
return toSet;
}
- public Collection<V> values() {
+ public @NonNullable Collection<V> values() {
this.collector.run();
Collection<KeyedSoftRef<V>> fromSet = map.values();
List<V> toCol = new ArrayList<V>(fromSet.size());
@@ -227,12 +228,12 @@
}
return toCol;
}
- public boolean containsKey(Object key) {
+ public boolean containsKey(@NonNullable Object key) {
if (key == null)
return false;
return this.get(key.toString()) != null;
}
- public boolean containsValue(Object value) {
+ public boolean containsValue(@NonNullable Object value) {
this.collector.run();
Collection<KeyedSoftRef<V>> fromSet = map.values();
1.2 +3 -2
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefCacheCleaner.java
Index: SoftRefCacheCleaner.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefCacheCleaner.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SoftRefCacheCleaner.java 22 Jan 2005 21:34:26 -0000 1.1
+++ SoftRefCacheCleaner.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -38,7 +38,8 @@
private volatile int countDataRaceAndRemovedByOthers;
private volatile int countBye;
- <V> void cleanupKey(Map<String, KeyedSoftRef<V>> map, String key) {
+ <V> void cleanupKey(@NonNullable Map<String, KeyedSoftRef<V>> map,
@NonNullable String key)
+ {
V val = null;
// already garbage collected. So try to clean up the key.
if (debug)
@@ -113,7 +114,7 @@
return countBye;
}
- public String toString() {
+ @Override public @NonNullable String toString() {
return ToStringBuilder.reflectionToString(this);
}
}
1.2 +13 -13
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefCacheSafe.java
Index: SoftRefCacheSafe.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/soft/SoftRefCacheSafe.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SoftRefCacheSafe.java 22 Jan 2005 21:34:26 -0000 1.1
+++ SoftRefCacheSafe.java 24 Jan 2005 10:33:22 -0000 1.2
@@ -32,54 +32,54 @@
public class SoftRefCacheSafe<V> extends SoftRefCache<V>
implements ICacheSafe<V>
{
- public SoftRefCacheSafe(String name, Class<V> valueType,
+ public SoftRefCacheSafe(@NonNullable String name, @NonNullable Class<V>
valueType,
int initialCapacity, float loadFactor, int concurrencyLevel)
{
super(name, valueType, initialCapacity, loadFactor,
concurrencyLevel);
}
- public SoftRefCacheSafe(String name, Class<V> valueType,
+ public SoftRefCacheSafe(@NonNullable String name, @NonNullable Class<V>
valueType,
int initialCapacity)
{
super(name, valueType, initialCapacity);
}
- public SoftRefCacheSafe(String name, Class<V> valueType) {
+ public SoftRefCacheSafe(@NonNullable String name, @NonNullable Class<V>
valueType) {
super(name, valueType);
}
- public V getCopy(String key) {
+ public V getCopy(@NonNullable String key) {
V val = this.get(key);
return this.dup(val);
}
- public V putCopy(String key, V value) {
+ public V putCopy(@NonNullable String key, @NonNullable V value) {
return this.put(key, this.dup(value));
}
- public void putAll(Map<? extends String, ? extends V> map) {
+ public void putAll(@NonNullable Map<? extends String, ? extends V> map) {
for (final Map.Entry<? extends String, ? extends V> e :
map.entrySet())
this.put(e.getKey(), e.getValue());
}
- public void putAllCopies(Map<? extends String, ? extends V> map) {
+ public void putAllCopies(@NonNullable Map<? extends String, ? extends V>
map) {
for (final Map.Entry<? extends String, ? extends V> e :
map.entrySet())
this.put(e.getKey(), this.dup(e.getValue()));
}
- public V getBeanCopy(String key) {
+ public V getBeanCopy(@NonNullable String key) {
V val = this.get(key);
return BeanUtils.inst.cloneDeep(val);
}
- public V putBeanCopy(String key, V value) {
+ public V putBeanCopy(@NonNullable String key, @NonNullable V value) {
return this.put(key, BeanUtils.inst.cloneDeep(value));
}
- public void putAllBeanCopies(Map<? extends String, ? extends V> map) {
+ public void putAllBeanCopies(@NonNullable Map<? extends String, ?
extends V> map) {
for (final Map.Entry<? extends String, ? extends V> e :
map.entrySet())
this.put(e.getKey(), BeanUtils.inst.cloneDeep(e.getValue()));
}
- public V getBeanClone(String key) {
+ public V getBeanClone(@NonNullable String key) {
V val = this.get(key);
return BeanUtils.inst.cloneShallow(val);
}
- public V putBeanClone(String key, V value) {
+ public V putBeanClone(@NonNullable String key, @NonNullable V value) {
return this.put(key, BeanUtils.inst.cloneShallow(value));
}
- public void putAllBeanClones(Map<? extends String, ? extends V> map) {
+ public void putAllBeanClones(@NonNullable Map<? extends String, ?
extends V> map) {
for (final Map.Entry<? extends String, ? extends V> e :
map.entrySet())
this.put(e.getKey(), BeanUtils.inst.cloneShallow(e.getValue()));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]