Skip to content

Commit 2ca0ec7

Browse files
committed
To make sure we always can get some useful logs, always keep 500 entry in log pool by switch to EvictingQueue
1 parent c895d61 commit 2ca0ec7

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

pom.xml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,12 @@
156156
</shadedPattern>
157157
</relocation>
158158
<relocation>
159-
<pattern>org.apache.commons.</pattern>
160-
<shadedPattern>org.maxgamer.quickshop.shade.org.apache.commons.</shadedPattern>
159+
<pattern>org.apache.commons.compress.</pattern>
160+
<shadedPattern>org.maxgamer.quickshop.shade.org.apache.commons.compress.</shadedPattern>
161+
</relocation>
162+
<relocation>
163+
<pattern>org.apache.commons.codec.</pattern>
164+
<shadedPattern>org.maxgamer.quickshop.shade.org.apache.commons.codec.</shadedPattern>
161165
</relocation>
162166
<relocation>
163167
<pattern>me.lucko.helper.</pattern>
@@ -844,11 +848,5 @@
844848
<version>2.8.0</version>
845849
<scope>provided</scope>
846850
</dependency>
847-
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
848-
<dependency>
849-
<groupId>org.apache.commons</groupId>
850-
<artifactId>commons-collections4</artifactId>
851-
<version>4.4</version>
852-
</dependency>
853851
</dependencies>
854852
</project>

src/main/java/org/maxgamer/quickshop/util/Util.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.maxgamer.quickshop.util;
2121

22+
import com.google.common.collect.EvictingQueue;
2223
import de.themoep.minedown.MineDown;
2324
import de.themoep.minedown.MineDownParser;
2425
import io.papermc.lib.PaperLib;
@@ -81,7 +82,8 @@ public class Util {
8182
private static final EnumMap<Material, Integer> CUSTOM_STACKSIZE = new EnumMap<>(Material.class);
8283
private static final EnumSet<Material> SHOPABLES = EnumSet.noneOf(Material.class);
8384
private static final List<BlockFace> VERTICAL_FACING = Collections.unmodifiableList(Arrays.asList(BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST));
84-
private static final List<String> DEBUG_LOGS = new ArrayList<>();
85+
@SuppressWarnings("UnstableApiUsage")
86+
private static final EvictingQueue<String> DEBUG_LOGS = EvictingQueue.create(500);
8587
private static final ReentrantReadWriteLock LOCK = new ReentrantReadWriteLock();
8688

8789
private static final ThreadLocal<MineDown> MINEDOWN = ThreadLocal.withInitial(() -> new MineDown(""));
@@ -325,9 +327,6 @@ public static void debugLog(@NotNull String... logs) {
325327
return;
326328
}
327329
LOCK.writeLock().lock();
328-
if (DEBUG_LOGS.size() >= 2000) {
329-
DEBUG_LOGS.clear();
330-
}
331330
if (!isDevMode()) {
332331
for (String log : logs) {
333332
DEBUG_LOGS.add("[DEBUG] " + log);

0 commit comments

Comments
 (0)