On Sat, 8 May 2021 19:10:50 GMT, Alexey Bakhtin <[email protected]> wrote:
>> src/java.base/share/classes/sun/security/util/Cache.java line 442:
>>
>>> 440: entry.invalidate();
>>> 441: return value;
>>> 442: }
>>
>> I may adjust the lines a little bit so as to avoid duplicated operations
>> (see the implementation code of isValid()).
>>
>>
>> long time = (lifetime == 0) ? 0 : System.currentTimeMillis();
>> if (entry.isValid(time)) {
>> V value = entry.getValue();
>> entry.invalidate();
>> return value;
>> } else {
>> if (DEBUG) {
>> System.out.println("Ignoring expired entry");
>> }
>> return null;
>> }
>
> I'd like to keep my code as-is. We still need invalidate() if entry is not
> valid (see remove() operation).
Did you notice that entry.isValid() implementation has already call
invalidate() if the entry is not valid?
-------------
PR: https://git.openjdk.java.net/jdk/pull/3664