to support null values while maintaining thread safety, you must avoid ConcurrentHashMap and use a synchronized HashMap instead

Signed-off-by: mdxabu <abdullahfakrudeen2020@gmail.com>
This commit is contained in:
mdxabu 2025-07-06 17:37:06 +05:30
parent 13dbeeefea
commit 549e97cd9f
1 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,8 @@
package dev.openfeature.sdk;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@ -47,8 +50,8 @@ public interface HookData {
/**
* Default thread-safe implementation of HookData.
*/
class DefaultHookData implements HookData {
private final ConcurrentMap<String, Object> data = new ConcurrentHashMap<>();
public class DefaultHookData implements HookData {
private final Map<String, Object> data = Collections.synchronizedMap(new HashMap<>());
@Override
public void set(String key, Object value) {