You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by th...@apache.org on 2021/12/03 16:17:08 UTC

[jackrabbit-oak] branch OAK-9634 created (now 972e2f3)

This is an automated email from the ASF dual-hosted git repository.

thomasm pushed a change to branch OAK-9634
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git.


      at 972e2f3  src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java

This branch includes the following new commits:

     new 972e2f3  src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[jackrabbit-oak] 01/01: src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java

Posted by th...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

thomasm pushed a commit to branch OAK-9634
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit 972e2f3fdc6adcc8e566c7fb03cc28270ad56cc1
Author: Thomas Mueller <th...@apache.org>
AuthorDate: Fri Dec 3 17:16:51 2021 +0100

    src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java
---
 .../java/org/apache/jackrabbit/oak/cache/CacheLIRS.java | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java
index f100240..3f755a3 100644
--- a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java
+++ b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java
@@ -1160,10 +1160,7 @@ public class CacheLIRS<K, V> implements LoadingCache<K, V> {
                 old = e.value;
                 invalidate(key, hash, RemovalCause.REPLACED);
             }
-            e = new Entry<K, V>();
-            e.key = key;
-            e.value = value;
-            e.memory = memory;
+            e = new Entry<K, V>(key, value, memory);
             Entry<K, V>[] array = entries;
             int mask = array.length - 1;
             int index = hash & mask;
@@ -1468,7 +1465,7 @@ public class CacheLIRS<K, V> implements LoadingCache<K, V> {
         /**
          * The key.
          */
-        K key;
+        final K key;
 
         /**
          * The value. Set to null for non-resident-cold entries.
@@ -1511,6 +1508,16 @@ public class CacheLIRS<K, V> implements LoadingCache<K, V> {
          */
         Entry<K, V> mapNext;
 
+        Entry(K key, V value, int memory) {
+            this.key = key;
+            this.value = value;
+            this.memory = memory;
+        }
+
+        Entry() {
+            this(null, null, 0);
+        }
+
         /**
          * Whether this entry is hot. Cold entries are in one of the two queues.
          *