Просмотр исходного кода

[error prone] suppress NonAtomicVolatileUpdate warning in SimpleLruCache

It's not important to update time field, scalability is more important
than perfect LRU ordering of cache entries.

Change-Id: I22466c580cd3613b81e1989130b2724af9d6c466
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v5.4.1.201908211225-r
Matthias Sohn 4 лет назад
Родитель
Сommit
b4cb06b294
1 измененных файлов: 2 добавлений и 0 удалений
  1. 2
    0
      org.eclipse.jgit/src/org/eclipse/jgit/util/SimpleLruCache.java

+ 2
- 0
org.eclipse.jgit/src/org/eclipse/jgit/util/SimpleLruCache.java Просмотреть файл

@@ -159,6 +159,7 @@ public class SimpleLruCache<K, V> {
*
* @return value mapped for this key, or {@code null} if no value is mapped
*/
@SuppressWarnings("NonAtomicVolatileUpdate")
public V get(Object key) {
Entry<K, V> entry = map.get(key);
if (entry != null) {
@@ -185,6 +186,7 @@ public class SimpleLruCache<K, V> {
* @throws NullPointerException
* if the specified key or value is null
*/
@SuppressWarnings("NonAtomicVolatileUpdate")
public V put(@NonNull K key, @NonNull V value) {
map.put(key, new Entry<>(key, value, ++time));
if (map.size() > maximumSize) {

Загрузка…
Отмена
Сохранить