mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8264032: Improve thread safety of Runtime.version()
Reviewed-by: shade, alanb
This commit is contained in:
parent
8c1ab38ee2
commit
233536263e
1 changed files with 6 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2019, Azul Systems, Inc. All rights reserved.
|
* Copyright (c) 2019, Azul Systems, Inc. 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.
|
||||||
*
|
*
|
||||||
|
@ -816,12 +816,14 @@ public class Runtime {
|
||||||
* @since 9
|
* @since 9
|
||||||
*/
|
*/
|
||||||
public static Version version() {
|
public static Version version() {
|
||||||
if (version == null) {
|
var v = version;
|
||||||
version = new Version(VersionProps.versionNumbers(),
|
if (v == null) {
|
||||||
|
v = new Version(VersionProps.versionNumbers(),
|
||||||
VersionProps.pre(), VersionProps.build(),
|
VersionProps.pre(), VersionProps.build(),
|
||||||
VersionProps.optional());
|
VersionProps.optional());
|
||||||
|
version = v;
|
||||||
}
|
}
|
||||||
return version;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue