mirror of
https://github.com/Minestom/Minestom.git
synced 2024-06-22 20:44:54 +02:00
Move OOM try-catch
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
afdc67fc26
commit
1851ea7eca
|
@ -276,7 +276,13 @@ public class PlayerSocketConnection extends PlayerConnection {
|
|||
public void flush() {
|
||||
try {
|
||||
synchronized (bufferLock) {
|
||||
updateLocalBuffer();
|
||||
try {
|
||||
updateLocalBuffer();
|
||||
} catch (OutOfMemoryError e) {
|
||||
this.waitingBuffers.clear();
|
||||
System.gc(); // Explicit gc forcing buffers to be collected
|
||||
throw new ClosedChannelException();
|
||||
}
|
||||
}
|
||||
synchronized (flushLock) {
|
||||
try {
|
||||
|
@ -291,10 +297,6 @@ public class PlayerSocketConnection extends PlayerConnection {
|
|||
} catch (IOException e) { // Couldn't write to the socket
|
||||
MinecraftServer.getExceptionManager().handleException(e);
|
||||
throw new ClosedChannelException();
|
||||
} catch (OutOfMemoryError e) { // Couldn't allocate a pooled buffer
|
||||
this.waitingBuffers.clear();
|
||||
System.gc(); // Explicit gc forcing buffers to be collected
|
||||
throw new ClosedChannelException();
|
||||
}
|
||||
}
|
||||
} catch (ClosedChannelException e) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user