-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically update classloader after adding a library with the add-library command #25153
Dynamically update classloader after adding a library with the add-library command #25153
Conversation
Dynamically updates the common classloader if a common library is added.
...eus/core/kernel/src/main/java/com/sun/enterprise/v3/server/CommonClassLoaderServiceImpl.java
Outdated
Show resolved
Hide resolved
Is it possible also to remove the library? I see there is the |
...eus/core/kernel/src/main/java/com/sun/enterprise/v3/server/CommonClassLoaderServiceImpl.java
Show resolved
Hide resolved
...eus/core/kernel/src/main/java/com/sun/enterprise/v3/server/CommonClassLoaderServiceImpl.java
Outdated
Show resolved
Hide resolved
Perhaps, on Linux (and Unix generally) library file will be removed, but library will be accessible until server stop/restart. On Windows |
The remove-library command just deletes the JAR on the file system. It could remove the url in the classloader but it’s not necessary. The CL will just ignore the url if the file doesn’t exist. So no need to remove the url from the CL. Classes loaded from the removed JAR will keep being loaded even after the JAR is removed. |
If JAR was already opened by CL, CL will not ignore this JAR. Application will load classes and resources from this JAR. |
We already have this command, so it should probably do more, ie. refuse to remove the file if it is used by any classloader and report that classloader to the user. We can try to do that in another PR, but for this reason I always pushed libraries inside ear/war files, because they have lifecycle while this is quite fragile. Could it be enough to disable the application and then remove the library? Maybe we can move this to discussions. |
Good idea ;) |
f6ca5db
to
26ce10e
Compare
And small changes based on review comments
26ce10e
to
44b7b98
Compare
I used a wrong phase for the assembly plugin. It's supposed to copy test classes before classloader tests are executed. Before the fix, it was executed before test classes were compiled, it tried to move non-existent classes and failed. |
Skip creting assembly for tests if tests are no compiled in the fastest profile
OK, the fastest profile disabled test compilation, so I needed to disable the assembly plugin in the fastest profile too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to hurry to merge it to 7.0.18, those two comments can be resolved in another PR (or I can add it to mine as I am messing with classloaders too)
Dynamically updates the common classloader if a common library is added. It means that restart is not needed to add the library to the classpath.