Skip to content

Commit 862d3d3

Browse files
authored
fix: Replace HashMap with ConcurrentHashMap to avoid race conditions (#157)
1 parent 042e5a1 commit 862d3d3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/iexec/commons/poco/chain/IexecHubAbstractService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838

3939
import java.io.IOException;
4040
import java.math.BigInteger;
41-
import java.util.HashMap;
4241
import java.util.Map;
4342
import java.util.Optional;
43+
import java.util.concurrent.ConcurrentHashMap;
4444

4545
import static com.iexec.commons.poco.chain.Web3jAbstractService.toBigInt;
4646
import static com.iexec.commons.poco.chain.Web3jAbstractService.toEthereumAddress;
@@ -71,8 +71,8 @@ public abstract class IexecHubAbstractService {
7171
private long maxNbOfPeriodsForConsensus = -1;
7272
private final long retryDelay;// ms
7373
private final int maxRetries;
74-
private final Map<Long, ChainCategory> categories = new HashMap<>();
75-
private final Map<String, TaskDescription> taskDescriptions = new HashMap<>();
74+
private final Map<Long, ChainCategory> categories = new ConcurrentHashMap<>();
75+
private final Map<String, TaskDescription> taskDescriptions = new ConcurrentHashMap<>();
7676

7777
protected IexecHubAbstractService(
7878
Credentials credentials,

0 commit comments

Comments
 (0)