Skip to content

Commit

Permalink
[github-709] Make BitFieldFactory threadsafe. Thanks to ZhangChen. This
Browse files Browse the repository at this point in the history
closes #709

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1921332 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
pjfanning committed Oct 15, 2024
1 parent f8bbec3 commit ab68210
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions poi/src/main/java/org/apache/poi/util/BitFieldFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ Licensed to the Apache Software Foundation (ASF) under one or more

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));
Expand Down

0 comments on commit ab68210

Please sign in to comment.