Skip to content

Commit

Permalink
Bugfix: Use a thread-safe version of the map for caching the MongoCol…
Browse files Browse the repository at this point in the history
…lection handle (#219)
  • Loading branch information
suresh-prakash authored Jan 29, 2025
1 parent c2eec6d commit a3fa786
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import com.mongodb.BasicDBObject;
import com.mongodb.ReadPreference;
import com.mongodb.client.MongoCollection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import lombok.Builder;
import lombok.Value;
import lombok.experimental.Accessors;
Expand All @@ -18,7 +18,7 @@ public class MongoCollectionOptionsApplier {
private final Map<CacheKey, MongoCollection<BasicDBObject>> collectionCache;

public MongoCollectionOptionsApplier() {
this.collectionCache = new HashMap<>();
this.collectionCache = new ConcurrentHashMap<>();
}

public MongoCollection<BasicDBObject> applyOptions(
Expand Down

0 comments on commit a3fa786

Please sign in to comment.