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() { protected void shutdown() {
this.messagingManager.get().withPacketService(packetService -> { this.messagingManager.get().withPacketService(packetService -> {
packetService.queuePacket(this.injector.getInstance(PacketFactory.class).clearLocalPlayersPacket()); 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); ConcurrentUtil.shutdownExecutor(this.periodicTasks, TimeUnit.MILLISECONDS, 500);
this.profileCache.save(); this.profileCache.save();
this.profileResolver.shutdown(); this.profileResolver.shutdown();
@@ -176,14 +176,14 @@ public class MessagingManager {
} }
public void onShutdown() { public void onShutdown() {
if (this.scheduledExecutor != null) {
ConcurrentUtil.shutdownExecutor(this.scheduledExecutor, TimeUnit.MILLISECONDS, 500);
}
if (this.packetService != null) { if (this.packetService != null) {
this.packetService.flushQueue(); this.packetService.flushQueue();
this.packetService.shutdown(); this.packetService.shutdown();
} }
if (this.scheduledExecutor != null) { // this.messagingService.close(); // todo - this is really slow, easier to just skip for now
ConcurrentUtil.shutdownExecutor(this.scheduledExecutor, TimeUnit.MILLISECONDS, 500);
}
this.messagingService.close();
} }
private void initMessagingService( private void initMessagingService(