Log warning message when failing to uninject from velocity initializer
It shouldn't break anything, but it's a massive memory leak Follow-up to #1379
This commit is contained in:
2 files changed
+11
-4
No files matched your search
+4
-2
@@ -82,9 +82,11 @@ public class VelocityPipelineInjector implements ChannelInjector {
|
||||
if (wrapper instanceof VelocityChannelInitializer) {
|
||||
try {
|
||||
SET_SERVER_INTIIALIZER.invoke(initializerHolder, ((VelocityChannelInitializer) wrapper).getWrappedInitializer());
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException | InvocationTargetException exception) {
|
||||
throw new RuntimeException("Failed to uninject from frontend pipeline", exception);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalStateException("Failed to uninject from frontend pipeline: can't unwrap foreign channel initializer");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -234,8 +234,13 @@ public class VelocityPacketEventsBuilder {
|
||||
@Override
|
||||
public void terminate() {
|
||||
if (initialized) {
|
||||
// Uninject the injector
|
||||
injector.uninject();
|
||||
// try to uninject the injector
|
||||
try {
|
||||
this.injector.uninject();
|
||||
} catch (Exception exception) {
|
||||
this.logManager.warn("Failed to uninject from initializer");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
// Remove handlers for players
|
||||
for (User user : this.protocolManager.getUsers()) {
|
||||
Channel channel = (Channel) user.getChannel();
|
||||
|
||||
Reference in new issue
Block a user