This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch 
refactoring/435-Improve-performance-of-ImportResolver
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git


The following commit(s) were added to 
refs/heads/refactoring/435-Improve-performance-of-ImportResolver by this push:
     new 1eb7fd8bc Issue #435: Improve performance of ImportResolver
1eb7fd8bc is described below

commit 1eb7fd8bca7fafe3ed659232703d3d3e00202e3c
Author: Richard Eckart de Castilho <r...@apache.org>
AuthorDate: Wed Jan 22 18:09:46 2025 +0100

    Issue #435: Improve performance of ImportResolver
    
    - Added method to clear the service cache
---
 .../main/java/org/apache/uima/internal/util/ServiceLoaderUtil.java  | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/uimaj-core/src/main/java/org/apache/uima/internal/util/ServiceLoaderUtil.java 
b/uimaj-core/src/main/java/org/apache/uima/internal/util/ServiceLoaderUtil.java
index f2820db6f..b024a5f90 100644
--- 
a/uimaj-core/src/main/java/org/apache/uima/internal/util/ServiceLoaderUtil.java
+++ 
b/uimaj-core/src/main/java/org/apache/uima/internal/util/ServiceLoaderUtil.java
@@ -41,6 +41,12 @@ public class ServiceLoaderUtil {
   private static final WeakIdentityMap<ClassLoader, Map<Class<?>, List<?>>> 
cl_to_services = //
           WeakIdentityMap.newHashMap();
 
+  public static void clearServiceCache() {
+    synchronized (cl_to_services) {
+      cl_to_services.clear();
+    }
+  }
+
   public static <T> Stream<T> loadServicesSafely(Class<T> aService) {
     var cl = ClassLoaderUtils.findClassLoader();
     return loadServicesSafely(aService, cl, null);

Reply via email to