From: PJ Fanning Date: Tue, 15 Oct 2024 12:58:33 +0000 (+0000) Subject: [github-709] Make BitFieldFactory threadsafe. Thanks to ZhangChen. This closes #709 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ab68210d2ace09d73a9468d908e61ab56750bb31;p=poi.git [github-709] Make BitFieldFactory threadsafe. Thanks to ZhangChen. This closes #709 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1921332 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/poi/src/main/java/org/apache/poi/util/BitFieldFactory.java b/poi/src/main/java/org/apache/poi/util/BitFieldFactory.java index 4893d5e61b..40e69cb0bd 100644 --- a/poi/src/main/java/org/apache/poi/util/BitFieldFactory.java +++ b/poi/src/main/java/org/apache/poi/util/BitFieldFactory.java @@ -18,13 +18,13 @@ package org.apache.poi.util; -import java.util.*; +import java.util.concurrent.ConcurrentHashMap; /** * Returns immutable Bitfield instances. */ public class BitFieldFactory { - private static Map instances = new HashMap<>(); + private static final ConcurrentHashMap instances = new ConcurrentHashMap<>(); public static BitField getInstance(int mask) { return instances.computeIfAbsent(mask, k -> new BitField(mask));