This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-classloaders.git
The following commit(s) were added to refs/heads/main by this push:
new c6c4e1a Fix DigestUtils usage (#64)
c6c4e1a is described below
commit c6c4e1aa4a31b951439ae9498d1cff033c361263
Author: Christopher Tubbs <[email protected]>
AuthorDate: Wed Feb 4 19:42:23 2026 -0500
Fix DigestUtils usage (#64)
new DigestUtils() instances are not thread-safe
---
.../java/org/apache/accumulo/classloader/lcc/util/LccUtils.java | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git
a/modules/local-caching-classloader/src/main/java/org/apache/accumulo/classloader/lcc/util/LccUtils.java
b/modules/local-caching-classloader/src/main/java/org/apache/accumulo/classloader/lcc/util/LccUtils.java
index 39e363d..85c0791 100644
---
a/modules/local-caching-classloader/src/main/java/org/apache/accumulo/classloader/lcc/util/LccUtils.java
+++
b/modules/local-caching-classloader/src/main/java/org/apache/accumulo/classloader/lcc/util/LccUtils.java
@@ -29,7 +29,6 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Comparator;
import java.util.LinkedHashSet;
-import java.util.concurrent.ConcurrentHashMap;
import
org.apache.accumulo.classloader.lcc.LocalCachingContextClassLoaderFactory;
import org.apache.accumulo.classloader.lcc.definition.ContextDefinition;
@@ -44,12 +43,12 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
public class LccUtils {
private static final Logger LOG = LoggerFactory.getLogger(LccUtils.class);
- private static final ConcurrentHashMap<String,DigestUtils> DIGESTERS = new
ConcurrentHashMap<>();
private static final Cleaner CLEANER = Cleaner.create();
- // keep at most one DigestUtils instance for each algorithm
+ // these instances are not thread-safe; calls to getClassLoader(context) and
the background
+ // monitor threads need distinct instances of these
public static DigestUtils getDigester(String algorithm) {
- return DIGESTERS.computeIfAbsent(algorithm, DigestUtils::new);
+ return new DigestUtils(algorithm);
}
private static String checksumForFileName(String algorithm, String checksum)
{