mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
SPIGOT-2634: Concurrency issue in FileIOThread
This commit is contained in:
parent
2f5bda8a67
commit
43ab2669d7
@ -90,7 +90,38 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,10 +179,14 @@
|
||||
@@ -98,20 +146,27 @@
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
- if (this.b.isEmpty()) {
|
||||
+ // CraftBukkit start
|
||||
+ Iterator<Map.Entry<ChunkCoordIntPair, NBTTagCompound>> iter = this.b.entrySet().iterator();
|
||||
+ if (!iter.hasNext()) {
|
||||
+ // CraftBukkit end
|
||||
if (this.f) {
|
||||
ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", new Object[] { this.d.getName()});
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.b.keySet().iterator().next();
|
||||
+ // CraftBukkit start
|
||||
+ Map.Entry<ChunkCoordIntPair, NBTTagCompound> entry = iter.next();
|
||||
+ iter.remove(); // Pop single entry
|
||||
+ ChunkCoordIntPair chunkcoordintpair = entry.getKey();
|
||||
+ // CraftBukkit end
|
||||
|
||||
boolean flag;
|
||||
|
||||
try {
|
||||
this.c.add(chunkcoordintpair);
|
||||
- NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.remove(chunkcoordintpair);
|
||||
+ NBTTagCompound nbttagcompound = (NBTTagCompound) entry.getValue(); // CraftBukkit
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
try {
|
||||
@@ -131,10 +186,14 @@
|
||||
}
|
||||
|
||||
private void b(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
|
||||
@ -106,7 +137,7 @@
|
||||
}
|
||||
|
||||
public void b(World world, Chunk chunk) throws IOException {}
|
||||
@@ -149,6 +201,7 @@
|
||||
@@ -149,6 +208,7 @@
|
||||
if (this.c()) {
|
||||
continue;
|
||||
}
|
||||
@ -114,7 +145,7 @@
|
||||
}
|
||||
} finally {
|
||||
this.f = false;
|
||||
@@ -326,6 +379,13 @@
|
||||
@@ -326,6 +386,13 @@
|
||||
chunk.a(nbttagcompound.getByteArray("Biomes"));
|
||||
}
|
||||
|
||||
@ -128,7 +159,7 @@
|
||||
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10);
|
||||
|
||||
if (nbttaglist1 != null) {
|
||||
@@ -369,7 +429,7 @@
|
||||
@@ -369,7 +436,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,7 +168,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -397,14 +457,20 @@
|
||||
@@ -397,14 +464,20 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -159,7 +190,7 @@
|
||||
return null;
|
||||
} else {
|
||||
if (nbttagcompound.hasKeyOfType("Passengers", 9)) {
|
||||
@@ -433,8 +499,14 @@
|
||||
@@ -433,8 +506,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user