Skip to content

Commit b3d61f4

Browse files
committed
Use synchronized HashMap instead of ConcurrentHashMap for cache file handlers (#392)
1 parent 92991e7 commit b3d61f4

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

lib/src/main/java/xyz/gianlu/librespot/cache/CacheManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import java.security.MessageDigest;
3434
import java.security.NoSuchAlgorithmException;
3535
import java.util.*;
36-
import java.util.concurrent.ConcurrentHashMap;
3736
import java.util.concurrent.TimeUnit;
3837

3938
import static xyz.gianlu.librespot.audio.storage.ChannelManager.CHUNK_SIZE;
@@ -55,7 +54,7 @@ public class CacheManager implements Closeable {
5554
private static final int HEADER_HASH = 253;
5655
private final File parent;
5756
private final CacheJournal journal;
58-
private final Map<String, Handler> fileHandlers = new ConcurrentHashMap<>();
57+
private final Map<String, Handler> fileHandlers = Collections.synchronizedMap(new HashMap<>());
5958

6059
public CacheManager(@NotNull Session.Configuration conf) throws IOException {
6160
if (!conf.cacheEnabled) {

0 commit comments

Comments
 (0)