mirror of
https://github.com/apache/poi.git
synced 2025-03-06 08:59:07 +00:00
[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
This commit is contained in:
parent
f8bbec3104
commit
ab68210d2a
@ -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<Integer, BitField> instances = new HashMap<>();
|
||||
private static final ConcurrentHashMap<Integer, BitField> instances = new ConcurrentHashMap<>();
|
||||
|
||||
public static BitField getInstance(int mask) {
|
||||
return instances.computeIfAbsent(mask, k -> new BitField(mask));
|
||||
|
Loading…
x
Reference in New Issue
Block a user