mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 04:55:47 +01:00
27c7749f42
- Re-removes Bukkit#getServerName - This was (hopefully?) only added back for Timings v2. It should be kept in that scope. - Intend to let PlayerViewDistance API slip. Given the scope of the changes in this area it seems best to let this slip past initial release. It can be re-added when there is additional time to focus on it and the changed systems it relies on. If it is fixed prior to release this is implemented as a single shim patch that can be dropped.
51 lines
2.1 KiB
Diff
51 lines
2.1 KiB
Diff
From 0ba1071a0c1c57dde48b29969baecb7dcc5a895e Mon Sep 17 00:00:00 2001
|
|
From: Antony Riley <antony@cyberiantiger.org>
|
|
Date: Tue, 29 Mar 2016 08:22:55 +0300
|
|
Subject: [PATCH] Sanitise RegionFileCache and make configurable.
|
|
|
|
RegionFileCache prior to this patch would close every single open region
|
|
file upon reaching a size of 256.
|
|
This patch modifies that behaviour so it closes the the least recently
|
|
used RegionFile.
|
|
The implementation uses a LinkedHashMap as an LRU cache (modified from HashMap).
|
|
The maximum size of the RegionFileCache is also made configurable.
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
index 6cc99ffe4..4424f7ef1 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
@@ -218,4 +218,9 @@ public class PaperConfig {
|
|
private static void loadPermsBeforePlugins() {
|
|
loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true);
|
|
}
|
|
+
|
|
+ public static int regionFileCacheSize = 256;
|
|
+ private static void regionFileCacheSize() {
|
|
+ regionFileCacheSize = getInt("settings.region-file-cache-size", 256);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
|
|
index 75731c919..c8573a8ee 100644
|
|
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
|
|
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
|
|
@@ -8,6 +8,7 @@ import java.io.DataOutputStream;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import javax.annotation.Nullable;
|
|
+import com.destroystokyo.paper.PaperConfig; // Paper
|
|
|
|
public abstract class RegionFileCache implements AutoCloseable {
|
|
|
|
@@ -25,7 +26,7 @@ public abstract class RegionFileCache implements AutoCloseable {
|
|
if (regionfile != null) {
|
|
return regionfile;
|
|
} else {
|
|
- if (this.cache.size() >= 256) {
|
|
+ if (this.cache.size() >= PaperConfig.regionFileCacheSize) {
|
|
this.cache.removeLast();
|
|
}
|
|
|
|
--
|
|
2.21.0
|
|
|