RFR: 8287390: Cleanup Map usage in AuthenticationInfo.requestAuthentication
Andrey Turbanov
aturbanov at openjdk.java.net
Thu May 26 20:41:10 UTC 2022
`AuthenticationInfo.requestAuthentication` uses separate `HashMap`'s `get` +`put` calls.
Thread t, c;
c = Thread.currentThread();
if ((t = requests.get(key)) == null) {
requests.put (key, c);
assert cached == null;
return cached;
}
if (t == c) {
assert cached == null;
return cached;
}
Instead we can use the `HashMap.putIfAbsent` to make code a bit easier to follow. We know that `requests` can contain only non-null values.
-------------
Commit messages:
- [PATCH] Cleanup Map usage in AuthenticationInfo.requestAuthentication
Changes: https://git.openjdk.java.net/jdk/pull/8484/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8484&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8287390
Stats: 10 lines in 1 file changed: 0 ins; 5 del; 5 mod
Patch: https://git.openjdk.java.net/jdk/pull/8484.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/8484/head:pull/8484
PR: https://git.openjdk.java.net/jdk/pull/8484
More information about the net-dev
mailing list