You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
seo-title: Support for override library in the application classloader and support for Java 25 in 25.0.0.10-beta - OpenLiberty.io
9
-
seo-description: Support for override libraries in the application classloader and Java 25 compatibility are introduced in 25.0.0.10-beta.
10
-
blog_description: Support for override libraries in the application classloader and Java 25 compatibility are introduced in 25.0.0.10-beta.
9
+
seo-description: Support for override libraries in the application classloader to fix the application without requiring the application to be rebuilt and Java 25 compatibility are introduced in 25.0.0.10-beta.
10
+
blog_description: Support for override libraries in the application classloader to fix the application without requiring the application to be rebuilt and Java 25 compatibility are introduced in 25.0.0.10-beta.
// change the "IMAGE CAPTION" to a couple words of what the image is
51
51
// // // // // // // //
52
52
53
-
Support for override libraries in the application classloader and Java 25 compatibility are introduced in 25.0.0.10-beta.
53
+
Support for override libraries in the application classloader to fix the application without requiring the application to be rebuilt and Java 25 compatibility are introduced in 25.0.0.10-beta.
54
54
55
55
// // // // // // // //
56
56
// Change the RELEASE_SUMMARY to an introductory paragraph. This sentence is really
@@ -61,7 +61,7 @@ Support for override libraries in the application classloader and Java 25 compat
61
61
62
62
The link:{url-about}[Open Liberty] 25.0.0.10-beta includes the following beta features (along with link:{url-prefix}/docs/latest/reference/feature/feature-overview.html[all GA features]):
63
63
64
-
* <<overrideLibrary, overrideLibrary support for application classloader>>
64
+
* <<overrideLibrary, OverrideLibrary support for application classloader>>
65
65
* <<beta_support_java25, Beta support for Java 25>>
66
66
67
67
// // // // // // // //
@@ -80,9 +80,9 @@ See also link:{url-prefix}/blog/?search=beta&key=tag[previous Open Liberty beta
80
80
// Contact/Reviewer: tjwatson
81
81
// // // // // // // //
82
82
[#overrideLibrary]
83
-
== overrideLibrary support for application classloader
83
+
== OverrideLibrary support for application classloader
84
84
85
-
The 25.0.0.10-beta release introduces a new type of library reference for configuring an application's <classloader/>. This new reference type is called an override library reference. An override library reference works similarly to a private library reference, where class instances remain unique to the application's classloader. However, the key difference is in the search order, the override library class path is searched before the application’s own class path.This allows the library path to override classes that are already contained within the application.
85
+
The 25.0.0.10-beta release introduces a new type of library reference for configuring an application's `<classloader/>`. This new reference type is called an override library reference. An override library reference works similarly to a private library reference, where class instances remain unique to the application's classloader. However, the key difference is in the search order, the override library class path is searched before the application’s own class path.This allows the library path to override classes that are already contained within the application.
86
86
87
87
For example, when a `<webApplication/>` contains a class like `org.acme.needs.fix.SomeImpl` that needs to be overridden in order to fix an issue, but rebuilding the application to include the fix is difficult or undesirable,as a new library JAR (e.g., someImplFix.jar) is built to include the corrected class files. Then the following `server.xml` could be used to configure an `overrideLibraryRef` to fix the application without requiring the application to be rebuilt:
An important note about using the `CompletableFuture` and `SubmissionPublisher` classes provided in the Java 25 JDK. If you do not have an explicit Executor backing them, the default is to use the `ForkJoinPool.commonPool`.The pool defaults to a parallelism value equal to the number of available processors minus 1 (# available processors - 1). If your application runs in an environment where you have 2 (or fewer) processors, you could run into issues with concurrency in Java 25 since you will only have 1 thread available by default. This was not an issue in earlier versions of Java as the JDK would overlook the parallelism value and create an additional thread.
139
-
To avoid this, you can:
140
-
1. Use the `CompletableFuture` provided in Liberty's Jakarta Concurrency implementation, which does not have this issue. An easy way to do that is with a link:https://www.ibm.com/docs/en/was-liberty/core?topic=manually-configuring-managed-executors[DefaultManagedExecutorService] and using link:https://jakarta.ee/specifications/concurrency/3.1/apidocs/jakarta.concurrency/jakarta/enterprise/concurrent/managedexecutorservice#supplyAsync(java.util.function.Supplier[supplyAsync or runAsync]).
141
-
2. Explicitly set the `ForkJoinPool.commonPool` parallelism value to whatever you need, `-Djava.util.concurrent.ForkJoinPool.common.parallelism=N` (where N is the minimum number of threads needed)
142
-
3. Use an explicit backing Executor
138
+
An important note about using the `CompletableFuture` and `SubmissionPublisher` classes in Java 25 JDK is that if there is no explicit Executor backing these classes, by default `ForkJoinPool.commonPool` will be used. The pool defaults to a parallelism value equal to the number of available processors minus 1 (# available processors - 1). If the application runs in an environment with 2 (or fewer) processors, there is a possibility of running into concurrency issue since Java 25 uses only 1 thread by default. This was not an issue in earlier versions of Java as the JDK would overlook the parallelism value and create an additional thread.
139
+
140
+
The above issue can be avoided by following the below steps:
141
+
142
+
. Use the `CompletableFuture` provided in Liberty's Jakarta Concurrency implementation, which does not have this issue. An easy way to do that is with a link:https://www.ibm.com/docs/en/was-liberty/core?topic=manually-configuring-managed-executors[DefaultManagedExecutorService] and using link:https://jakarta.ee/specifications/concurrency/3.1/apidocs/jakarta.concurrency/jakarta/enterprise/concurrent/managedexecutorservice#supplyAsync(java.util.function.Supplier[supplyAsync or runAsync]).
143
+
. Explicitly set the `ForkJoinPool.commonPool` parallelism value to whatever you need, `-Djava.util.concurrent.ForkJoinPool.common.parallelism=N` (where N is the minimum number of threads needed)
144
+
. Use an explicit backing Executor
143
145
144
146
For more information about this change, please reference the following links:
145
147
https://bugs.openjdk.org/browse/JDK-8362881
@@ -157,15 +159,6 @@ For more information on Open Liberty, please visit our link:https://openliberty.
157
159
158
160
// DO NOT MODIFY THIS LINE. </GHA-BLOG-TOPIC>
159
161
160
-
161
-
162
-
To enable the new beta features in your app, add them to your `server.xml`:
0 commit comments