RFR: JDK-8223322: Improve concurrency in jpackage instances

Alexey Semenyuk asemenyuk at openjdk.java.net
Thu Dec 17 23:26:56 UTC 2020


On Thu, 17 Dec 2020 20:46:50 GMT, Andy Herrick <herrick at openjdk.org> wrote:

> Remove all non final static variables in jpackage java code (using InheritableThreadLocal for Logger and Argument instances) and remove sychronization in JPackageToolProvider.

Changes requested by asemenyuk (Committer).

test/jdk/tools/jpackage/share/ConcurrentTest.java line 53:

> 51:                 JPackageCommand.helloAppImage("com.other/com.other.Hello")
> 52:         .useToolProvider(true)
> 53:         .setPackageType(PackageType.getDefault())

`.removeArgumentWithValue("--type")` can be used to make jpackage create default native package. This will eliminate need to introduce `packageType.getDefault()` method.

However, I'd rather replace JPackageCommand with PackageTest in this test scenario. Something like this:
final PackageTest cmd1 = new PackageTest()
.configureHelloApp()
.addInitializer(cmd -> {
    cmd.setArgumentValue("--name", "ConcurrentOtherInstaller");
});

`cmd1.run(PackageTest.Action.CREATE);` would result in a package creation but will no unpack or install will be attempted.

PackageTest is better as it will run tests on created package making sure it is valid.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1829


More information about the core-libs-dev mailing list