More shutdown fixes

This commit is contained in:
cyberpwn
2021-08-18 14:08:43 -04:00
parent 059d5542c9
commit 5286a69c34
4 changed files with 47 additions and 37 deletions
@@ -37,7 +37,6 @@ public class EditSVC implements IrisService {
@Override @Override
public void onEnable() { public void onEnable() {
this.editors = new KMap<>(); this.editors = new KMap<>();
Iris.info("EDIT SVC ENABLED!");
Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, this::update, 1000, 1000); Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, this::update, 1000, 1000);
} }
@@ -74,7 +74,9 @@ public class PreservationSVC implements IrisService
@Override @Override
public void onDisable() { public void onDisable() {
dereferencer.interrupt(); dereferencer.interrupt();
dereference();
postShutdown(() -> {
for(Thread i : threads) for(Thread i : threads)
{ {
if(i.isAlive()) if(i.isAlive())
@@ -87,7 +89,7 @@ public class PreservationSVC implements IrisService
catch(Throwable e) catch(Throwable e)
{ {
Iris.reportError(e);
} }
} }
} }
@@ -102,7 +104,7 @@ public class PreservationSVC implements IrisService
catch(Throwable e) catch(Throwable e)
{ {
Iris.reportError(e);
} }
} }
@@ -116,10 +118,9 @@ public class PreservationSVC implements IrisService
catch(Throwable e) catch(Throwable e)
{ {
Iris.reportError(e);
} }
} }
});
dereference();
} }
} }
@@ -29,6 +29,7 @@ import com.volmit.iris.engine.framework.WrongEngineBroException;
import com.volmit.iris.engine.object.common.IrisWorld; import com.volmit.iris.engine.object.common.IrisWorld;
import com.volmit.iris.engine.object.dimensional.IrisDimension; import com.volmit.iris.engine.object.dimensional.IrisDimension;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.hunk.Hunk; import com.volmit.iris.util.hunk.Hunk;
import com.volmit.iris.util.io.ReactiveFolder; import com.volmit.iris.util.io.ReactiveFolder;
import com.volmit.iris.util.scheduling.ChronoLatch; import com.volmit.iris.util.scheduling.ChronoLatch;
@@ -161,7 +162,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
r.run(); r.run();
loadLock.release(LOAD_LOCKS); loadLock.release(LOAD_LOCKS);
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); Iris.reportError(e);
} }
}); });
} }
@@ -207,7 +207,16 @@ public class Mantle {
}); });
} }
try
{
b.complete(); b.complete();
}
catch(Throwable e)
{
Iris.reportError(e);
}
ioBurst.shutdownNow(); ioBurst.shutdownNow();
Iris.debug("The Mantle has Closed " + C.DARK_AQUA + dataFolder.getAbsolutePath()); Iris.debug("The Mantle has Closed " + C.DARK_AQUA + dataFolder.getAbsolutePath());
} }