From 0934c8ef16c5ffe55aeec95333639945450bb25b Mon Sep 17 00:00:00 2001 From: TheMode Date: Sat, 5 Feb 2022 06:17:04 +0100 Subject: [PATCH] counter thread provider should never update partitions Signed-off-by: TheMode --- src/main/java/net/minestom/server/thread/ThreadProvider.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/net/minestom/server/thread/ThreadProvider.java b/src/main/java/net/minestom/server/thread/ThreadProvider.java index 1830d2f56..45d1592ab 100644 --- a/src/main/java/net/minestom/server/thread/ThreadProvider.java +++ b/src/main/java/net/minestom/server/thread/ThreadProvider.java @@ -1,7 +1,5 @@ package net.minestom.server.thread; -import com.github.benmanes.caffeine.cache.Cache; -import com.github.benmanes.caffeine.cache.Caffeine; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -12,12 +10,11 @@ import java.util.concurrent.atomic.AtomicInteger; public interface ThreadProvider { static @NotNull ThreadProvider counter() { return new ThreadProvider<>() { - private final Cache cache = Caffeine.newBuilder().weakKeys().build(); private final AtomicInteger counter = new AtomicInteger(); @Override public int findThread(@NotNull T partition) { - return cache.get(partition, i -> counter.getAndIncrement()); + return counter.getAndIncrement(); } }; }