修复加载JREs时可能的并发修改异常

This commit is contained in:
yushijinhun
2018-06-07 00:46:16 +08:00
parent 6a89f0a661
commit d75c3b584a
2 changed files with 37 additions and 22 deletions

View File

@@ -165,6 +165,10 @@ public final class JavaVersion implements Serializable {
private static List<JavaVersion> JAVAS;
private static final CountDownLatch LATCH = new CountDownLatch(1);
public static Optional<List<JavaVersion>> getJREsImmediately() {
return Optional.ofNullable(JAVAS);
}
public static List<JavaVersion> getJREs() throws InterruptedException {
if (JAVAS != null)
return JAVAS;