mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-16 05:02:19 +01:00
Shutdown the server on OOM
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
e43d001076
commit
5a4fc95ffd
@ -1,5 +1,6 @@
|
|||||||
package net.minestom.server.exception;
|
package net.minestom.server.exception;
|
||||||
|
|
||||||
|
import net.minestom.server.MinecraftServer;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,7 +16,12 @@ public final class ExceptionManager {
|
|||||||
* @param e the occurred exception
|
* @param e the occurred exception
|
||||||
*/
|
*/
|
||||||
public void handleException(Throwable e) {
|
public void handleException(Throwable e) {
|
||||||
// TODO handle OOM exceptions
|
if (e instanceof OutOfMemoryError) {
|
||||||
|
// OOM should be handled manually
|
||||||
|
e.printStackTrace();
|
||||||
|
MinecraftServer.stopCleanly();
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.getExceptionHandler().handleException(e);
|
this.getExceptionHandler().handleException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user