coderzc commented on code in PR #21402:
URL: https://github.com/apache/pulsar/pull/21402#discussion_r1366886884
##########
pulsar-common/src/main/java/org/apache/pulsar/common/nar/NarClassLoader.java:
##########
@@ -283,4 +304,32 @@ protected String findLibrary(final String libname) {
public String toString() {
return NarClassLoader.class.getName() + "[" +
narWorkingDirectory.getPath() + "]";
}
+
+ @Override
+ public void close() throws IOException {
+ if (this.release() == 0) {
+ CACHED_CLASS_LOADER.compute(classLoaderCacheKey, (k,
narClassLoader) -> {
Review Comment:
Return null in `compute` block also can remove the classLoader from the
cache.
##########
pulsar-common/src/main/java/org/apache/pulsar/common/nar/NarClassLoader.java:
##########
@@ -283,4 +304,32 @@ protected String findLibrary(final String libname) {
public String toString() {
return NarClassLoader.class.getName() + "[" +
narWorkingDirectory.getPath() + "]";
}
+
+ @Override
+ public void close() throws IOException {
+ if (this.release() == 0) {
+ CACHED_CLASS_LOADER.compute(classLoaderCacheKey, (k,
narClassLoader) -> {
Review Comment:
Return null in `compute` block can also remove the classLoader from the
cache.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]