Threadpool refactoring.

This commit is contained in:
MobiusDev
2018-04-02 14:50:53 +00:00
parent 317478a66d
commit 0c201f75e7
1127 changed files with 5204 additions and 5174 deletions

View File

@@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
@@ -258,7 +258,7 @@ public final class QueenAnt extends AbstractNpcAI
{
((L2MonsterInstance) npc).getMinionList().spawnMinions(npc.getParameters().getMinionList("Privates"));
}
_task = ThreadPoolManager.scheduleAtFixedRate(new QueenAntTask(), 5 * 1000, 5 * 1000);
_task = ThreadPool.scheduleAtFixedRate(new QueenAntTask(), 5 * 1000, 5 * 1000);
break;
}
}

View File

@@ -19,7 +19,7 @@ package custom.events.Elpies;
import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.datatables.SpawnTable;
import com.l2jmobius.gameserver.model.L2Spawn;
import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -112,7 +112,7 @@ public final class Elpies extends Event
Broadcast.toAllOnlinePlayers("Help us exterminate them!");
Broadcast.toAllOnlinePlayers("You have " + EVENT_DURATION_MINUTES + " minutes!");
_eventTask = ThreadPoolManager.schedule(() ->
_eventTask = ThreadPool.schedule(() ->
{
Broadcast.toAllOnlinePlayers("Time is up!");
eventStop();

View File

@@ -22,7 +22,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -138,7 +138,7 @@ public final class Race extends Event
Broadcast.toAllOnlinePlayers("Visit Event Manager in Dion village and signup, you have " + _time_register + " min before Race Start...");
// Schedule Event end
_eventTask = ThreadPoolManager.schedule(() -> StartRace(), _time_register * 60 * 1000);
_eventTask = ThreadPool.schedule(() -> StartRace(), _time_register * 60 * 1000);
return true;
@@ -181,7 +181,7 @@ public final class Race extends Event
}
}
// Schedule timeup for Race
_eventTask = ThreadPoolManager.schedule(() -> timeUp(), _time_race * 60 * 1000);
_eventTask = ThreadPool.schedule(() -> timeUp(), _time_race * 60 * 1000);
}
@Override

View File

@@ -20,7 +20,7 @@ import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
@@ -46,7 +46,7 @@ public class AdminTest implements IAdminCommandHandler
{
if (command.equals("admin_stats"))
{
for (String line : ThreadPoolManager.getStats())
for (String line : ThreadPool.getStats())
{
activeChar.sendMessage(line);
}

View File

@@ -16,7 +16,7 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.SubclassInfoType;
import com.l2jmobius.gameserver.model.StatsSet;
@@ -56,7 +56,7 @@ public class ClassChange extends AbstractEffect
{
final L2PcInstance player = effected.getActingPlayer();
// TODO: FIX ME - Executing 1 second later otherwise interupted exception during storeCharBase()
ThreadPoolManager.schedule(() ->
ThreadPool.schedule(() ->
{
final int activeClass = player.getClassId().getId();

View File

@@ -16,7 +16,7 @@
*/
package handlers.playeractions;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.ai.CtrlEvent;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.ai.NextAction;
@@ -129,7 +129,7 @@ public final class SocialAction implements IPlayerActionHandler
player.sendPacket(sm);
if (!player.isProcessingRequest())
{
ThreadPoolManager.schedule(() -> scheduleDeny(player), 10000);
ThreadPool.schedule(() -> scheduleDeny(player), 10000);
player.blockRequest();
}
return;

View File

@@ -16,8 +16,8 @@
*/
package handlers.punishmenthandlers;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.LoginServerThread;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
import com.l2jmobius.gameserver.model.L2World;
@@ -162,7 +162,7 @@ public class JailHandler implements IPunishmentHandler
OlympiadManager.getInstance().removeDisconnectedCompetitor(player);
}
ThreadPoolManager.schedule(new TeleportTask(player, L2JailZone.getLocationIn()), 2000);
ThreadPool.schedule(new TeleportTask(player, L2JailZone.getLocationIn()), 2000);
// Open a Html message to inform the player
final NpcHtmlMessage msg = new NpcHtmlMessage();
@@ -198,7 +198,7 @@ public class JailHandler implements IPunishmentHandler
*/
private static void removeFromPlayer(L2PcInstance player)
{
ThreadPoolManager.schedule(new TeleportTask(player, L2JailZone.getLocationOut()), 2000);
ThreadPool.schedule(new TeleportTask(player, L2JailZone.getLocationOut()), 2000);
// Open a Html message to inform the player
final NpcHtmlMessage msg = new NpcHtmlMessage();

View File

@@ -34,10 +34,10 @@ import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.GameServer;
import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.LoginServerThread;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.enums.ItemLocation;
import com.l2jmobius.gameserver.model.L2Object;
@@ -199,7 +199,7 @@ public class Debug implements ITelnetCommand
}
sb.append("\r\n## Thread Pool Manager Statistics ##\r\n");
for (String line : ThreadPoolManager.getStats())
for (String line : ThreadPool.getStats())
{
sb.append(line);
sb.append("\r\n");

View File

@@ -17,7 +17,7 @@
package handlers.telnethandlers.server;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
import io.netty.channel.ChannelHandlerContext;
@@ -44,7 +44,7 @@ public class Performance implements ITelnetCommand
{
// ThreadPoolManager.purge();
final StringBuilder sb = new StringBuilder();
for (String line : ThreadPoolManager.getStats())
for (String line : ThreadPool.getStats())
{
sb.append(line + Config.EOL);
}

View File

@@ -17,7 +17,7 @@
package handlers.telnethandlers.server;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
import io.netty.channel.ChannelHandlerContext;
@@ -42,9 +42,9 @@ public class Purge implements ITelnetCommand
@Override
public String handle(ChannelHandlerContext ctx, String[] args)
{
ThreadPoolManager.purge();
ThreadPool.purge();
final StringBuilder sb = new StringBuilder("STATUS OF THREAD POOLS AFTER PURGE COMMAND:" + Config.EOL);
for (String line : ThreadPoolManager.getStats())
for (String line : ThreadPool.getStats())
{
sb.append(line + Config.EOL);
}

View File

@@ -20,7 +20,7 @@ import java.util.HashMap;
import java.util.concurrent.Future;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.handler.IVoicedCommandHandler;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.tasks.player.AutoPotionTask;
@@ -70,7 +70,7 @@ public class AutoPotion implements IVoicedCommandHandler
AUTO_POTION_TASKS.get(playerOID).cancel(true);
AUTO_POTION_TASKS.remove(playerOID);
}
AUTO_POTION_TASKS.put(activeChar.getObjectId(), ThreadPoolManager.scheduleAtFixedRate(new AutoPotionTask(activeChar), POTION_TASK_DELAY, POTION_TASK_DELAY));
AUTO_POTION_TASKS.put(activeChar.getObjectId(), ThreadPool.scheduleAtFixedRate(new AutoPotionTask(activeChar), POTION_TASK_DELAY, POTION_TASK_DELAY));
activeChar.sendMessage("Auto potions is enabled.");
return true;
}