partially fix MessagingManager shutdown

This commit is contained in:
Jason Penilla authored and Jason committed 2023-08-08 09:23:57 -07:00
1 parent a393a53a37
commit cdb9d618f9
2 files changed
+5 -6

No files matched your search

@@ -141,9 +141,8 @@ public abstract class CarbonChatInternal<C extends CarbonPlayer> implements Carb
protected void shutdown() {
this.messagingManager.get().withPacketService(packetService -> {
packetService.queuePacket(this.injector.getInstance(PacketFactory.class).clearLocalPlayersPacket());
packetService.flushQueue(); // todo remove
});
// this.messagingManager.get().onShutdown(); // todo fix this taking so long
this.messagingManager.get().onShutdown();
ConcurrentUtil.shutdownExecutor(this.periodicTasks, TimeUnit.MILLISECONDS, 500);
this.profileCache.save();
this.profileResolver.shutdown();
@@ -176,14 +176,14 @@ public class MessagingManager {
}
public void onShutdown() {
if (this.scheduledExecutor != null) {
ConcurrentUtil.shutdownExecutor(this.scheduledExecutor, TimeUnit.MILLISECONDS, 500);
}
if (this.packetService != null) {
this.packetService.flushQueue();
this.packetService.shutdown();
}
if (this.scheduledExecutor != null) {
ConcurrentUtil.shutdownExecutor(this.scheduledExecutor, TimeUnit.MILLISECONDS, 500);
}
this.messagingService.close();
// this.messagingService.close(); // todo - this is really slow, easier to just skip for now
}
private void initMessagingService(