From 3585b3910fa850671be14a401f0c366a26c11500 Mon Sep 17 00:00:00 2001 From: Ilya Lisov Date: Mon, 22 Jan 2024 11:31:19 +0300 Subject: [PATCH] #20 Change Map to thread-safe implementation --- .../io/github/ilyalisov/jwt/storage/TokenStorageImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/ilyalisov/jwt/storage/TokenStorageImpl.java b/src/main/java/io/github/ilyalisov/jwt/storage/TokenStorageImpl.java index 9e48058..ef9be47 100644 --- a/src/main/java/io/github/ilyalisov/jwt/storage/TokenStorageImpl.java +++ b/src/main/java/io/github/ilyalisov/jwt/storage/TokenStorageImpl.java @@ -2,25 +2,25 @@ import io.github.ilyalisov.jwt.config.TokenParameters; -import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; /** - * Basic implementation of TokenStorage. Not thread-safe. + * Basic implementation of TokenStorage. */ public class TokenStorageImpl implements TokenStorage { /** * Inner map of key-value pairs. */ - private final Map tokens; + private final ConcurrentHashMap tokens; /** * Creates an object. */ public TokenStorageImpl( ) { - this.tokens = new HashMap<>(); + this.tokens = new ConcurrentHashMap<>(); } private String subjectTokenKey(