Commit cacd8e1
committed
Use relaxed reads for key
The key fixed unless the node transitions to the retired or dead state under
the node's lock. When it does, the entry should not be visible from the caller's
perspective. This was audited to verify correct usages.
The conditional remove was modified to follow the standard pattern of remove,
then transition. It was implemented as a conditional transition followed by a
remove. This was legacy from CLHM where compute() methods had not originally
been available. By using computeIfPresent to conditionally remove, we have more
assurance of the correct behavior. The previous may have even been wrong if the
value had been weak/soft GC'd.
Relaxed reads should offer a slight performance improvement due to avoiding
unnecessary memory barriers.1 parent 333b776 commit cacd8e1
File tree
5 files changed
+61
-62
lines changed- caffeine/src
- javaPoet/java/com/github/benmanes/caffeine/cache
- main/java/com/github/benmanes/caffeine/cache
- test/java/com/github/benmanes/caffeine/cache
5 files changed
+61
-62
lines changedLines changed: 10 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
| 135 | + | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
| 364 | + | |
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
371 | | - | |
| 371 | + | |
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
| 382 | + | |
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
405 | 403 | | |
406 | 404 | | |
407 | | - | |
| 405 | + | |
| 406 | + | |
408 | 407 | | |
409 | 408 | | |
410 | 409 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
Lines changed: 36 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
473 | | - | |
| 473 | + | |
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
| |||
943 | 943 | | |
944 | 944 | | |
945 | 945 | | |
946 | | - | |
947 | | - | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
948 | 955 | | |
949 | 956 | | |
950 | 957 | | |
951 | 958 | | |
952 | | - | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
953 | 963 | | |
954 | 964 | | |
955 | 965 | | |
| |||
958 | 968 | | |
959 | 969 | | |
960 | 970 | | |
961 | | - | |
962 | 971 | | |
963 | | - | |
| 972 | + | |
964 | 973 | | |
965 | 974 | | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
972 | | - | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
973 | 984 | | |
974 | | - | |
975 | | - | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
976 | 991 | | |
977 | 992 | | |
978 | | - | |
| 993 | + | |
979 | 994 | | |
980 | | - | |
| 995 | + | |
981 | 996 | | |
982 | 997 | | |
983 | 998 | | |
| |||
1128 | 1143 | | |
1129 | 1144 | | |
1130 | 1145 | | |
1131 | | - | |
| 1146 | + | |
1132 | 1147 | | |
1133 | 1148 | | |
1134 | 1149 | | |
| |||
1312 | 1327 | | |
1313 | 1328 | | |
1314 | 1329 | | |
1315 | | - | |
| 1330 | + | |
1316 | 1331 | | |
1317 | 1332 | | |
1318 | 1333 | | |
| |||
1537 | 1552 | | |
1538 | 1553 | | |
1539 | 1554 | | |
1540 | | - | |
| 1555 | + | |
1541 | 1556 | | |
1542 | 1557 | | |
1543 | 1558 | | |
| |||
1808 | 1823 | | |
1809 | 1824 | | |
1810 | 1825 | | |
1811 | | - | |
| 1826 | + | |
1812 | 1827 | | |
1813 | 1828 | | |
1814 | 1829 | | |
| |||
Lines changed: 0 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | 76 | | |
93 | 77 | | |
94 | 78 | | |
| |||
Lines changed: 13 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
118 | 123 | | |
119 | 124 | | |
120 | | - | |
| 125 | + | |
121 | 126 | | |
122 | 127 | | |
123 | 128 | | |
| |||
127 | 132 | | |
128 | 133 | | |
129 | 134 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| |||
0 commit comments