mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8209987: Minor cleanup in Level.java
Reviewed-by: dfuchs
This commit is contained in:
parent
b4530e2447
commit
c5299d49f4
1 changed files with 6 additions and 18 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -610,10 +610,7 @@ public class Level implements java.io.Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerWithClassLoader(Level customLevel) {
|
private static void registerWithClassLoader(Level customLevel) {
|
||||||
PrivilegedAction<ClassLoader> pa =
|
PrivilegedAction<ClassLoader> pa = customLevel.getClass()::getClassLoader;
|
||||||
() -> customLevel.getClass().getClassLoader();
|
|
||||||
PrivilegedAction<String> pn = customLevel.getClass()::getName;
|
|
||||||
final String name = AccessController.doPrivileged(pn);
|
|
||||||
final ClassLoader cl = AccessController.doPrivileged(pa);
|
final ClassLoader cl = AccessController.doPrivileged(pa);
|
||||||
CUSTOM_LEVEL_CLV.computeIfAbsent(cl, (c, v) -> new ArrayList<>())
|
CUSTOM_LEVEL_CLV.computeIfAbsent(cl, (c, v) -> new ArrayList<>())
|
||||||
.add(customLevel);
|
.add(customLevel);
|
||||||
|
@ -624,19 +621,10 @@ public class Level implements java.io.Serializable {
|
||||||
// the mirroredLevel object is always added to the list
|
// the mirroredLevel object is always added to the list
|
||||||
// before the custom Level instance
|
// before the custom Level instance
|
||||||
KnownLevel o = new KnownLevel(l);
|
KnownLevel o = new KnownLevel(l);
|
||||||
List<KnownLevel> list = nameToLevels.get(l.name);
|
nameToLevels.computeIfAbsent(l.name, (k) -> new ArrayList<>())
|
||||||
if (list == null) {
|
.add(o);
|
||||||
list = new ArrayList<>();
|
intToLevels.computeIfAbsent(l.value, (k) -> new ArrayList<>())
|
||||||
nameToLevels.put(l.name, list);
|
.add(o);
|
||||||
}
|
|
||||||
list.add(o);
|
|
||||||
|
|
||||||
list = intToLevels.get(l.value);
|
|
||||||
if (list == null) {
|
|
||||||
list = new ArrayList<>();
|
|
||||||
intToLevels.put(l.value, list);
|
|
||||||
}
|
|
||||||
list.add(o);
|
|
||||||
|
|
||||||
// keep the custom level reachable from its class loader
|
// keep the custom level reachable from its class loader
|
||||||
// This will ensure that custom level values are not GC'ed
|
// This will ensure that custom level values are not GC'ed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue