switch InMemoryStateProvider to use synchronizedMap, to avoid ConcurrentModificationException in clean method

This commit is contained in:
2025-05-05 10:59:12 -05:00
parent fa4cf8ca16
commit 625ed5209c
2 changed files with 36 additions and 7 deletions

View File

@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.core.state;
import java.io.Serializable;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
@ -58,7 +59,7 @@ public class InMemoryStateProvider implements StateProviderInterface
*******************************************************************************/
private InMemoryStateProvider()
{
this.map = new HashMap<>();
this.map = Collections.synchronizedMap(new HashMap<>());
///////////////////////////////////////////////////////////
// Start a single thread executor to handle the cleaning //