|
28 | 28 | import lombok.Getter; |
29 | 29 | import lombok.Setter; |
30 | 30 | import me.minebuilders.clearlag.listeners.ItemMergeListener; |
| 31 | +import okhttp3.OkHttpClient; |
31 | 32 | import org.apache.commons.lang3.StringUtils; |
32 | 33 | import org.bukkit.Bukkit; |
33 | 34 | import org.bukkit.OfflinePlayer; |
|
101 | 102 | import org.maxgamer.quickshop.shop.SimpleShopManager; |
102 | 103 | import org.maxgamer.quickshop.shop.VirtualDisplayItem; |
103 | 104 | import org.maxgamer.quickshop.util.GameVersion; |
| 105 | +import org.maxgamer.quickshop.util.HttpUtil; |
104 | 106 | import org.maxgamer.quickshop.util.JsonUtil; |
105 | 107 | import org.maxgamer.quickshop.util.MsgUtil; |
106 | 108 | import org.maxgamer.quickshop.util.PermissionChecker; |
@@ -792,10 +794,20 @@ public final void onDisable() { |
792 | 794 | } |
793 | 795 |
|
794 | 796 | Util.debugLog("Cleanup listeners..."); |
795 | | - |
796 | 797 | HandlerList.unregisterAll(this); |
797 | 798 | Util.debugLog("Unregistering plugin services..."); |
798 | 799 | getServer().getServicesManager().unregisterAll(this); |
| 800 | + Util.debugLog("Shutdown okhttp client..."); |
| 801 | + try { |
| 802 | + OkHttpClient client = HttpUtil.getClientInstance(); |
| 803 | + client.dispatcher().executorService().shutdown(); |
| 804 | + client.connectionPool().evictAll(); |
| 805 | + okhttp3.Cache cache = client.cache(); |
| 806 | + if (cache != null) { |
| 807 | + cache.close(); |
| 808 | + } |
| 809 | + } catch (Throwable ignored) { |
| 810 | + } |
799 | 811 | Util.debugLog("Cleanup..."); |
800 | 812 | Util.debugLog("All shutdown work is finished."); |
801 | 813 |
|
|
0 commit comments