Fix exceptions from tasks being ignored

This commit is contained in:
Thinkofdeath 2015-02-02 20:53:21 +00:00
parent 4c6df1b96b
commit d3d1361042

View file

@ -1,5 +1,5 @@
--- ../decompile-8eb82bde//net/minecraft/server/MinecraftServer.java 2014-12-03 14:33:55.037564649 -0500 --- ../work/decompile-8eb82bde//net/minecraft/server/MinecraftServer.java 2015-02-02 20:53:00.268118352 +0000
+++ src/main/java/net/minecraft/server/MinecraftServer.java 2014-12-03 14:33:47.061564766 -0500 +++ src/main/java/net/minecraft/server/MinecraftServer.java 2015-02-02 20:53:00.284118351 +0000
@@ -37,6 +37,18 @@ @@ -37,6 +37,18 @@
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -394,7 +394,22 @@
this.methodProfiler.a("save"); this.methodProfiler.a("save");
this.v.savePlayers(); this.v.savePlayers();
this.saveChunks(true); this.saveChunks(true);
@@ -493,20 +649,40 @@ @@ -484,29 +640,53 @@
synchronized (this.i) {
while (!this.i.isEmpty()) {
try {
- ((FutureTask) this.i.poll()).run();
+ // CraftBukkit start - log exceptions
+ FutureTask task = ((FutureTask) this.i.poll());
+ task.run();
+ task.get();
} catch (Throwable throwable) {
- MinecraftServer.LOGGER.fatal(throwable);
+ MinecraftServer.LOGGER.fatal("Handling task", throwable);
+ // CraftBukkit end
}
}
}
this.methodProfiler.c("levels"); this.methodProfiler.c("levels");
@ -438,7 +453,7 @@
this.methodProfiler.a("tick"); this.methodProfiler.a("tick");
@@ -533,9 +709,9 @@ @@ -533,9 +713,9 @@
worldserver.getTracker().updatePlayers(); worldserver.getTracker().updatePlayers();
this.methodProfiler.b(); this.methodProfiler.b();
this.methodProfiler.b(); this.methodProfiler.b();
@ -450,7 +465,7 @@
} }
this.methodProfiler.c("connection"); this.methodProfiler.c("connection");
@@ -559,10 +735,11 @@ @@ -559,10 +739,11 @@
this.o.add(iupdateplayerlistbox); this.o.add(iupdateplayerlistbox);
} }
@ -463,7 +478,7 @@
boolean flag = true; boolean flag = true;
String s = null; String s = null;
String s1 = "."; String s1 = ".";
@@ -636,6 +813,27 @@ @@ -636,6 +817,27 @@
dedicatedserver.B(); dedicatedserver.B();
Runtime.getRuntime().addShutdownHook(new ThreadShutdown("Server Shutdown Thread", dedicatedserver)); Runtime.getRuntime().addShutdownHook(new ThreadShutdown("Server Shutdown Thread", dedicatedserver));
@ -491,7 +506,7 @@
} catch (Exception exception) { } catch (Exception exception) {
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception); MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
} }
@@ -643,8 +841,10 @@ @@ -643,8 +845,10 @@
} }
public void B() { public void B() {
@ -502,7 +517,7 @@
} }
public File d(String s) { public File d(String s) {
@@ -660,7 +860,14 @@ @@ -660,7 +864,14 @@
} }
public WorldServer getWorldServer(int i) { public WorldServer getWorldServer(int i) {
@ -518,7 +533,7 @@
} }
public String C() { public String C() {
@@ -696,17 +903,62 @@ @@ -696,17 +907,62 @@
} }
public String getPlugins() { public String getPlugins() {
@ -588,7 +603,7 @@
} }
public void h(String s) { public void h(String s) {
@@ -721,7 +973,7 @@ @@ -721,7 +977,7 @@
} }
public String getServerModName() { public String getServerModName() {
@ -597,7 +612,7 @@
} }
public CrashReport b(CrashReport crashreport) { public CrashReport b(CrashReport crashreport) {
@@ -734,6 +986,7 @@ @@ -734,6 +990,7 @@
} }
public List tabCompleteCommand(ICommandListener icommandlistener, String s, BlockPosition blockposition) { public List tabCompleteCommand(ICommandListener icommandlistener, String s, BlockPosition blockposition) {
@ -605,7 +620,7 @@
ArrayList arraylist = Lists.newArrayList(); ArrayList arraylist = Lists.newArrayList();
if (s.startsWith("/")) { if (s.startsWith("/")) {
@@ -772,6 +1025,9 @@ @@ -772,6 +1029,9 @@
return arraylist; return arraylist;
} }
@ -615,7 +630,7 @@
} }
public static MinecraftServer getServer() { public static MinecraftServer getServer() {
@@ -779,7 +1035,7 @@ @@ -779,7 +1039,7 @@
} }
public boolean N() { public boolean N() {
@ -624,7 +639,7 @@
} }
public String getName() { public String getName() {
@@ -835,8 +1091,10 @@ @@ -835,8 +1095,10 @@
} }
public void a(EnumDifficulty enumdifficulty) { public void a(EnumDifficulty enumdifficulty) {
@ -637,7 +652,7 @@
if (worldserver != null) { if (worldserver != null) {
if (worldserver.getWorldData().isHardcore()) { if (worldserver.getWorldData().isHardcore()) {
@@ -878,15 +1136,17 @@ @@ -878,15 +1140,17 @@
this.N = true; this.N = true;
this.getConvertable().d(); this.getConvertable().d();
@ -658,7 +673,7 @@
this.safeShutdown(); this.safeShutdown();
} }
@@ -919,9 +1179,11 @@ @@ -919,9 +1183,11 @@
int i = 0; int i = 0;
if (this.worldServer != null) { if (this.worldServer != null) {
@ -673,7 +688,7 @@
WorldData worlddata = worldserver.getWorldData(); WorldData worlddata = worldserver.getWorldData();
mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimension())); mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimension()));
@@ -954,7 +1216,7 @@ @@ -954,7 +1220,7 @@
public abstract boolean ad(); public abstract boolean ad();
public boolean getOnlineMode() { public boolean getOnlineMode() {
@ -682,7 +697,7 @@
} }
public void setOnlineMode(boolean flag) { public void setOnlineMode(boolean flag) {
@@ -1024,8 +1286,10 @@ @@ -1024,8 +1290,10 @@
} }
public void setGamemode(EnumGamemode enumgamemode) { public void setGamemode(EnumGamemode enumgamemode) {
@ -695,7 +710,7 @@
} }
} }
@@ -1057,7 +1321,7 @@ @@ -1057,7 +1325,7 @@
} }
public World getWorld() { public World getWorld() {
@ -704,7 +719,7 @@
} }
public Entity f() { public Entity f() {
@@ -1125,11 +1389,10 @@ @@ -1125,11 +1393,10 @@
} }
public Entity a(UUID uuid) { public Entity a(UUID uuid) {
@ -720,7 +735,7 @@
if (worldserver != null) { if (worldserver != null) {
Entity entity = worldserver.getEntity(uuid); Entity entity = worldserver.getEntity(uuid);
@@ -1144,7 +1407,7 @@ @@ -1144,7 +1411,7 @@
} }
public boolean getSendCommandFeedback() { public boolean getSendCommandFeedback() {