13
0
geforkt von Mirrors/Paper

Hoist out synchronisation from ChunkRegionLoader

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2018-09-10 19:13:03 +10:00
Ursprung de1ca9f6ed
Commit 5d0094a169
2 geänderte Dateien mit 18 neuen und 30 gelöschten Zeilen

Datei anzeigen

@ -84,7 +84,7 @@
++i; ++i;
} }
} }
@@ -267,6 +291,40 @@ @@ -267,6 +291,42 @@
return false; return false;
} }
@ -112,12 +112,14 @@
+ } + }
+ } + }
+ // Moved from unloadChunks above + // Moved from unloadChunks above
+ chunk.removeEntities(); + synchronized (this.chunkLoader) {
+ if (save) { + chunk.removeEntities();
+ this.saveChunk(chunk); + if (save) {
+ this.saveChunk(chunk);
+ }
+ this.chunks.remove(chunk.chunkKey);
+ this.lastChunk = null;
+ } + }
+ this.chunks.remove(chunk.chunkKey);
+ this.lastChunk = null;
+ return true; + return true;
+ } + }
+ // CraftBukkit end + // CraftBukkit end

Datei anzeigen

@ -1,11 +1,6 @@
--- a/net/minecraft/server/ChunkRegionLoader.java --- a/net/minecraft/server/ChunkRegionLoader.java
+++ b/net/minecraft/server/ChunkRegionLoader.java +++ b/net/minecraft/server/ChunkRegionLoader.java
@@ -27,11 +27,11 @@ @@ -31,7 +31,7 @@
public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
private static final Logger a = LogManager.getLogger();
- private final Map<ChunkCoordIntPair, NBTTagCompound> b = Maps.newHashMap();
+ private final Map<ChunkCoordIntPair, NBTTagCompound> b = java.util.Collections.synchronizedMap(Maps.newHashMap()); // CraftBukkit
private final File c; private final File c;
private final DataFixer d; private final DataFixer d;
private PersistentStructureLegacy e; private PersistentStructureLegacy e;
@ -170,7 +165,7 @@
} else { } else {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level"); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level");
@@ -217,10 +289,15 @@ @@ -217,10 +289,14 @@
} }
public boolean a() { public boolean a() {
@ -180,7 +175,6 @@
+ } + }
+ private boolean processSaveQueueEntry(boolean logCompletion) { + private boolean processSaveQueueEntry(boolean logCompletion) {
+ synchronized (this.b) { // CraftBukkit
+ Iterator iterator = this.b.entrySet().iterator(); + Iterator iterator = this.b.entrySet().iterator();
if (!iterator.hasNext()) { if (!iterator.hasNext()) {
- if (this.f) { - if (this.f) {
@ -188,7 +182,7 @@
ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.c.getName()); ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.c.getName());
} }
@@ -236,10 +313,14 @@ @@ -236,10 +312,14 @@
return true; return true;
} else { } else {
try { try {
@ -204,15 +198,7 @@
if (this.e != null) { if (this.e != null) {
this.e.a(chunkcoordintpair.a()); this.e.a(chunkcoordintpair.a());
} }
@@ -250,6 +331,7 @@ @@ -266,15 +346,16 @@
return true;
}
}
+ } // CraftBukkit
}
private ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) {
@@ -266,15 +348,16 @@
public void b() { public void b() {
try { try {
@ -232,7 +218,7 @@
} }
} }
@@ -303,7 +386,7 @@ @@ -303,7 +384,7 @@
if (abiomebase != null) { if (abiomebase != null) {
for (int k = 0; k < abiomebase.length; ++k) { for (int k = 0; k < abiomebase.length; ++k) {
@ -241,7 +227,7 @@
} }
} }
@@ -385,7 +468,7 @@ @@ -385,7 +466,7 @@
int[] aint = new int[abiomebase.length]; int[] aint = new int[abiomebase.length];
for (int i = 0; i < abiomebase.length; ++i) { for (int i = 0; i < abiomebase.length; ++i) {
@ -250,7 +236,7 @@
} }
nbttagcompound.setIntArray("Biomes", aint); nbttagcompound.setIntArray("Biomes", aint);
@@ -487,27 +570,27 @@ @@ -487,27 +568,27 @@
} }
ChunkConverter chunkconverter = nbttagcompound.hasKeyOfType("UpgradeData", 10) ? new ChunkConverter(nbttagcompound.getCompound("UpgradeData")) : ChunkConverter.a; ChunkConverter chunkconverter = nbttagcompound.hasKeyOfType("UpgradeData", 10) ? new ChunkConverter(nbttagcompound.getCompound("UpgradeData")) : ChunkConverter.a;
@ -284,7 +270,7 @@
long i1 = nbttagcompound.getLong("InhabitedTime"); long i1 = nbttagcompound.getLong("InhabitedTime");
Chunk chunk = new Chunk(generatoraccess.getMinecraftWorld(), i, j, abiomebase, chunkconverter, protochunkticklist, protochunkticklist1, i1); Chunk chunk = new Chunk(generatoraccess.getMinecraftWorld(), i, j, abiomebase, chunkconverter, protochunkticklist, protochunkticklist1, i1);
@@ -850,17 +933,29 @@ @@ -850,17 +931,29 @@
} }
@Nullable @Nullable
@ -316,7 +302,7 @@
}); });
} }
@@ -874,8 +969,14 @@ @@ -874,8 +967,14 @@
} }
} }
@ -332,7 +318,7 @@
Iterator iterator = entity.bP().iterator(); Iterator iterator = entity.bP().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -891,7 +992,7 @@ @@ -891,7 +990,7 @@
boolean flag = false; boolean flag = false;
try { try {