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
@@ -16,8 +16,8 @@
*/ */
package ai.areas.DenOfDevil; package ai.areas.DenOfDevil;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.Location;
@@ -127,7 +127,7 @@ public final class DenOfEvil extends AbstractNpcAI
zone.addSkill(skillId, skillLevel + 1); zone.addSkill(skillId, skillLevel + 1);
if (skillLevel == 3) // 3+1=4 if (skillLevel == 3) // 3+1=4
{ {
ThreadPoolManager.schedule(new KashaDestruction(zone), 2 * 60 * 1000l); ThreadPool.schedule(new KashaDestruction(zone), 2 * 60 * 1000l);
zone.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.DEFEAT_KASHA_S_EYES_TO_LIFT_THE_GREAT_CURSE)); zone.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.DEFEAT_KASHA_S_EYES_TO_LIFT_THE_GREAT_CURSE));
} }
else if (skillLevel == 2) else if (skillLevel == 2)
@@ -140,7 +140,7 @@ public final class DenOfEvil extends AbstractNpcAI
@Override @Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{ {
ThreadPoolManager.schedule(new RespawnNewEye(npc.getLocation()), 15000); ThreadPool.schedule(new RespawnNewEye(npc.getLocation()), 15000);
final L2EffectZone zone = ZoneManager.getInstance().getZone(npc, L2EffectZone.class); final L2EffectZone zone = ZoneManager.getInstance().getZone(npc, L2EffectZone.class);
if (zone == null) if (zone == null)
{ {
@@ -213,7 +213,7 @@ public final class DenOfEvil extends AbstractNpcAI
final L2Npc npc = (L2Npc) character; final L2Npc npc = (L2Npc) character;
if (CommonUtil.contains(EYE_IDS, npc.getId())) if (CommonUtil.contains(EYE_IDS, npc.getId()))
{ {
ThreadPoolManager.schedule(new RespawnNewEye(npc.getLocation()), 15000); ThreadPool.schedule(new RespawnNewEye(npc.getLocation()), 15000);
} }
} }
} }
@@ -20,8 +20,8 @@ import java.text.SimpleDateFormat;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -129,7 +129,7 @@ public final class Parade extends AbstractNpcAI
{ {
// Starts at 8:00 and repeats every 6 hours. // Starts at 8:00 and repeats every 6 hours.
final long diff = timeLeftMilli(8, 0, 0), cycle = 3600000L; final long diff = timeLeftMilli(8, 0, 0), cycle = 3600000L;
ThreadPoolManager.scheduleAtFixedRate(new Start(), diff, cycle); ThreadPool.scheduleAtFixedRate(new Start(), diff, cycle);
// Test - Starts 3 minutes after server startup and repeats every 20 minutes. // Test - Starts 3 minutes after server startup and repeats every 20 minutes.
// final long diff = timeLeftMilli(8, 0, 0), cycle = 600000L; // final long diff = timeLeftMilli(8, 0, 0), cycle = 600000L;
@@ -167,9 +167,9 @@ public final class Parade extends AbstractNpcAI
public void run() public void run()
{ {
load(); load();
spawnTask = ThreadPoolManager.scheduleAtFixedRate(new Spawn(), 0, 5000); spawnTask = ThreadPool.scheduleAtFixedRate(new Spawn(), 0, 5000);
deleteTask = ThreadPoolManager.scheduleAtFixedRate(new Delete(), 10000, 1000); deleteTask = ThreadPool.scheduleAtFixedRate(new Delete(), 10000, 1000);
cleanTask = ThreadPoolManager.schedule(new Clean(), 420000); cleanTask = ThreadPool.schedule(new Clean(), 420000);
} }
} }
@@ -27,8 +27,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.IGameXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.geoengine.GeoEngine;
@@ -256,7 +256,7 @@ public final class FourSepulchers extends AbstractNpcAI implements IGameXmlReade
if ((doorInfo[0] == sepulcherId) && (doorInfo[1] == currentWave)) if ((doorInfo[0] == sepulcherId) && (doorInfo[1] == currentWave))
{ {
openDoor(doorInfo[2], 0); openDoor(doorInfo[2], 0);
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
closeDoor(doorInfo[2], 0); closeDoor(doorInfo[2], 0);
}, 15000); }, 15000);
@@ -578,7 +578,7 @@ public final class FourSepulchers extends AbstractNpcAI implements IGameXmlReade
showHtmlFile(player, npcId + "-OK.html", npc, null); showHtmlFile(player, npcId + "-OK.html", npc, null);
// Kick all players when/if time is over // Kick all players when/if time is over
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
ZoneManager.getInstance().getZoneById(MANAGER_ZONES.get(npcId)).oustAllPlayers(); ZoneManager.getInstance().getZoneById(MANAGER_ZONES.get(npcId)).oustAllPlayers();
}, TIME_ATTACK * 60 * 1000); }, TIME_ATTACK * 60 * 1000);
@@ -16,7 +16,7 @@
*/ */
package ai.areas.Rune.AltarOfSacrifice; package ai.areas.Rune.AltarOfSacrifice;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -109,7 +109,7 @@ public class AltarOfSacrifice extends AbstractNpcAI
private void sendMessage(L2Npc npc, NpcStringId npcString, int delay) private void sendMessage(L2Npc npc, NpcStringId npcString, int delay)
{ {
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
if (npc != null) if (npc != null)
{ {
@@ -20,7 +20,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.CategoryType;
@@ -340,7 +340,7 @@ public final class AwakeningMaster extends AbstractNpcAI
player.sendSkillList(); player.sendSkillList();
} }
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
player.sendPacket(ExShowUsm.AWAKENING_END); player.sendPacket(ExShowUsm.AWAKENING_END);
}, 10000); }, 10000);
@@ -22,7 +22,7 @@ import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -174,7 +174,7 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
_templates.stream().forEach(t -> t.spawn(g -> String.valueOf(g.getName()).equalsIgnoreCase(zoneName.concat("_demonic")), null)); _templates.stream().forEach(t -> t.spawn(g -> String.valueOf(g.getName()).equalsIgnoreCase(zoneName.concat("_demonic")), null));
zone.getPlayersInside().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 600, 0, NpcStringId.DEMONIC_SYSTEM_ACTIVATED))); zone.getPlayersInside().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 600, 0, NpcStringId.DEMONIC_SYSTEM_ACTIVATED)));
currentInfo.setZoneStage(7); currentInfo.setZoneStage(7);
ThreadPoolManager.schedule(new changeZoneStage(zone), 600000); // 10min ThreadPool.schedule(new changeZoneStage(zone), 600000); // 10min
} }
else else
{ {
@@ -202,7 +202,7 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
if (currentInfo.getZoneStage() < 6) if (currentInfo.getZoneStage() < 6)
{ {
currentInfo.setZoneStage(currentInfo.getZoneStage() + 1); currentInfo.setZoneStage(currentInfo.getZoneStage() + 1);
ThreadPoolManager.schedule(new changeZoneStage(zone), 5000); ThreadPool.schedule(new changeZoneStage(zone), 5000);
} }
} }
catch (Exception e) catch (Exception e)
@@ -248,7 +248,7 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
if (calcPoints >= 300) if (calcPoints >= 300)
{ {
calcPoints = 300; calcPoints = 300;
ThreadPoolManager.schedule(new changeZoneStage(currentZone.getKey()), 1000); ThreadPool.schedule(new changeZoneStage(currentZone.getKey()), 1000);
} }
currentInfo.setCurrentPoint(calcPoints); currentInfo.setCurrentPoint(calcPoints);
for (L2PcInstance player : currentZone.getKey().getPlayersInside()) for (L2PcInstance player : currentZone.getKey().getPlayersInside())
@@ -21,8 +21,8 @@ import java.util.List;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.datatables.SpawnTable; import com.l2jmobius.gameserver.datatables.SpawnTable;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
@@ -303,7 +303,7 @@ public class Lindvior extends AbstractNpcAI
} }
else if ((percent <= 75) && (_status == 1)) else if ((percent <= 75) && (_status == 1))
{ {
_bigVortexesTask = ThreadPoolManager.schedule(() -> spawnServitor(1, 300, _lindvior.getLocation(), NPC_ATTACKER_BIG_VORTEX), 1000); _bigVortexesTask = ThreadPool.schedule(() -> spawnServitor(1, 300, _lindvior.getLocation(), NPC_ATTACKER_BIG_VORTEX), 1000);
for (Location loc : ATTACKER_SMALL_VORTEX_SPAWNS) for (Location loc : ATTACKER_SMALL_VORTEX_SPAWNS)
{ {
addSpawn(LINDVIOR_SERVITOR[1], loc, true); addSpawn(LINDVIOR_SERVITOR[1], loc, true);
@@ -324,7 +324,7 @@ public class Lindvior extends AbstractNpcAI
{ {
addSpawn(LINDVIOR_SERVITOR[2], loc, true); addSpawn(LINDVIOR_SERVITOR[2], loc, true);
} }
_skillCastTask = ThreadPoolManager.scheduleAtFixedRate(() -> _lindvior.doCast(SKILL_REFLECT.getSkill()), 5000, 80000); _skillCastTask = ThreadPool.scheduleAtFixedRate(() -> _lindvior.doCast(SKILL_REFLECT.getSkill()), 5000, 80000);
_status = 3; _status = 3;
} }
else if ((percent <= 40) && (_status == 3)) else if ((percent <= 40) && (_status == 3))
@@ -348,7 +348,7 @@ public class Lindvior extends AbstractNpcAI
} }
else if ((percent <= 35) && (_status == 4)) else if ((percent <= 35) && (_status == 4))
{ {
_smallVortexesTask = ThreadPoolManager.scheduleAtFixedRate(() -> _smallVortexesTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
for (Location loc : ATTACKER_SMALL_VORTEX_SPAWNS) for (Location loc : ATTACKER_SMALL_VORTEX_SPAWNS)
{ {
@@ -372,14 +372,14 @@ public class Lindvior extends AbstractNpcAI
_lindvior.deleteMe(); _lindvior.deleteMe();
_lindvior = (L2GrandBossInstance) addSpawn(LINDVIOR_RAID, _lindvior.getLocation(), false, 0, false); _lindvior = (L2GrandBossInstance) addSpawn(LINDVIOR_RAID, _lindvior.getLocation(), false, 0, false);
_lindvior.setCurrentHp(_lindvior.getMaxHp() * 0.2); _lindvior.setCurrentHp(_lindvior.getMaxHp() * 0.2);
_bigVortexesTask = ThreadPoolManager.schedule(() -> spawnServitor(1, 300, _lindvior.getLocation(), NPC_ATTACKER_BIG_VORTEX), 1000); _bigVortexesTask = ThreadPool.schedule(() -> spawnServitor(1, 300, _lindvior.getLocation(), NPC_ATTACKER_BIG_VORTEX), 1000);
for (Location loc : ATTACKER_SMALL_VORTEX_SPAWNS) for (Location loc : ATTACKER_SMALL_VORTEX_SPAWNS)
{ {
addSpawn(NPC_ATTACKER_SMALL_VORTEX, loc, true); addSpawn(NPC_ATTACKER_SMALL_VORTEX, loc, true);
addSpawn(LINDVIOR_SERVITOR[4], loc, true); addSpawn(LINDVIOR_SERVITOR[4], loc, true);
addSpawn(LINDVIOR_SERVITOR[3], loc, true); addSpawn(LINDVIOR_SERVITOR[3], loc, true);
} }
_collapseTask = ThreadPoolManager.schedule(Lindvior.this::Clean, 600000); _collapseTask = ThreadPool.schedule(Lindvior.this::Clean, 600000);
_status = 6; _status = 6;
} }
return super.onAttack(npc, attacker, damage, isSummon); return super.onAttack(npc, attacker, damage, isSummon);
@@ -580,7 +580,7 @@ public class Lindvior extends AbstractNpcAI
_guardSpawn.add(npc); _guardSpawn.add(npc);
} }
_mobsSpawnTask = ThreadPoolManager.scheduleAtFixedRate(() -> _mobsSpawnTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
for (Location loc : ATTACKER_GENERATOR_SPAWNS) for (Location loc : ATTACKER_GENERATOR_SPAWNS)
{ {
@@ -596,7 +596,7 @@ public class Lindvior extends AbstractNpcAI
}, 30000, 80000); }, 30000, 80000);
_dummyLindvior = addSpawn(LINDVIOR_CAMERA, 45259, -27115, -638, 41325, false, 0, false); _dummyLindvior = addSpawn(LINDVIOR_CAMERA, 45259, -27115, -638, 41325, false, 0, false);
_announceTask = ThreadPoolManager.scheduleAtFixedRate(() -> _zoneLair.getPlayersInside().forEach(player -> player.sendPacket(new ExShowScreenMessage(NpcStringId.YOU_MUST_ACTIVATE_THE_4_GENERATORS, ExShowScreenMessage.TOP_CENTER, 7000, true))), 10000, 20000); _announceTask = ThreadPool.scheduleAtFixedRate(() -> _zoneLair.getPlayersInside().forEach(player -> player.sendPacket(new ExShowScreenMessage(NpcStringId.YOU_MUST_ACTIVATE_THE_4_GENERATORS, ExShowScreenMessage.TOP_CENTER, 7000, true))), 10000, 20000);
break; break;
} }
case 2: // After activation of 4 generators, we wait to be charged case 2: // After activation of 4 generators, we wait to be charged
@@ -621,7 +621,7 @@ public class Lindvior extends AbstractNpcAI
{ {
guard.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ALL_4_GENERATORS_MUST_BE_ACTIVATED); guard.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ALL_4_GENERATORS_MUST_BE_ACTIVATED);
}); });
_announceProtect = ThreadPoolManager.scheduleAtFixedRate(() -> _zoneLair.getPlayersInside().forEach(p -> player.sendPacket(new ExShowScreenMessage(NpcStringId.PROTECT_THE_GENERATOR, ExShowScreenMessage.TOP_CENTER, 7000, true))), 10000, 18000); _announceProtect = ThreadPool.scheduleAtFixedRate(() -> _zoneLair.getPlayersInside().forEach(p -> player.sendPacket(new ExShowScreenMessage(NpcStringId.PROTECT_THE_GENERATOR, ExShowScreenMessage.TOP_CENTER, 7000, true))), 10000, 18000);
_zoneLair.broadcastPacket(new SpecialCamera(_dummyLindvior, 3300, 200, 20, 11000, 10500, 0, 8, 1, 0, 0)); _zoneLair.broadcastPacket(new SpecialCamera(_dummyLindvior, 3300, 200, 20, 11000, 10500, 0, 8, 1, 0, 0));
_generatorSpawn.forEach(npc -> npc.sendInfo(player)); _generatorSpawn.forEach(npc -> npc.sendInfo(player));
startQuestTimer("show_movie", 13000, null, null); startQuestTimer("show_movie", 13000, null, null);
@@ -696,7 +696,7 @@ public class Lindvior extends AbstractNpcAI
_zoneLair.broadcastPacket(new SocialAction(_lindvior.getObjectId(), 1)); _zoneLair.broadcastPacket(new SocialAction(_lindvior.getObjectId(), 1));
_zoneLair.getPlayersInside().forEach(_lindvior::sendInfo); _zoneLair.getPlayersInside().forEach(_lindvior::sendInfo);
_zoneLair.broadcastPacket(new ExShowScreenMessage(NpcStringId.LINDVIOR_HAS_FALLEN_FROM_THE_SKY, ExShowScreenMessage.TOP_CENTER, 7000)); _zoneLair.broadcastPacket(new ExShowScreenMessage(NpcStringId.LINDVIOR_HAS_FALLEN_FROM_THE_SKY, ExShowScreenMessage.TOP_CENTER, 7000));
_mobsSpawnTask = ThreadPoolManager.scheduleAtFixedRate(() -> spawnServitor(2, 1000, _lindvior.getLocation(), LINDVIOR_SERVITOR), 60000, 180000); _mobsSpawnTask = ThreadPool.scheduleAtFixedRate(() -> spawnServitor(2, 1000, _lindvior.getLocation(), LINDVIOR_SERVITOR), 60000, 180000);
break; break;
} }
} }
@@ -749,12 +749,12 @@ public class Lindvior extends AbstractNpcAI
_dummyLindvior.deleteMe(); _dummyLindvior.deleteMe();
_lindvior2 = addSpawn(LINDVIOR_FAKE, CENTER_LOCATION, false, 0, false); _lindvior2 = addSpawn(LINDVIOR_FAKE, CENTER_LOCATION, false, 0, false);
_lindvior2.setTargetable(false); _lindvior2.setTargetable(false);
_announceTask = ThreadPoolManager.scheduleAtFixedRate(() -> _zoneLair.getPlayersInside().forEach(p -> p.sendPacket(new ExShowScreenMessage(NpcStringId.CHARGE_THE_CANNON_USING_THE_GENERATOR, ExShowScreenMessage.TOP_CENTER, 7000, true))), 40000, 20000); _announceTask = ThreadPool.scheduleAtFixedRate(() -> _zoneLair.getPlayersInside().forEach(p -> p.sendPacket(new ExShowScreenMessage(NpcStringId.CHARGE_THE_CANNON_USING_THE_GENERATOR, ExShowScreenMessage.TOP_CENTER, 7000, true))), 40000, 20000);
break; break;
} }
case "start_charge": case "start_charge":
{ {
_skillCastTask = ThreadPoolManager.scheduleAtFixedRate(() -> _generatorSpawn.forEach(generators -> _skillCastTask = ThreadPool.scheduleAtFixedRate(() -> _generatorSpawn.forEach(generators ->
{ {
int index = generators.getScriptValue(); int index = generators.getScriptValue();
if (!generators.isCastingNow() && (generators.getEffectList().getBuffInfoBySkillId(SKILL_RECHARGE_POSIBLE.getSkillId()) == null) && !hasFlag(_chargedMask, 1 << index)) if (!generators.isCastingNow() && (generators.getEffectList().getBuffInfoBySkillId(SKILL_RECHARGE_POSIBLE.getSkillId()) == null) && !hasFlag(_chargedMask, 1 << index))
@@ -780,7 +780,7 @@ public class Lindvior extends AbstractNpcAI
}); });
} }
}), 10000, 20000); }), 10000, 20000);
_LynDracoTask = ThreadPoolManager.scheduleAtFixedRate(() -> _LynDracoTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
for (Location loc : LYN_DRACO_SPAWNS) for (Location loc : LYN_DRACO_SPAWNS)
{ {
@@ -830,7 +830,7 @@ public class Lindvior extends AbstractNpcAI
_mobsSpawnTask = null; _mobsSpawnTask = null;
} }
_zoneLair.getCharactersInside().stream().filter(L2Character::isNpc).forEach(mob -> mob.deleteMe()); _zoneLair.getCharactersInside().stream().filter(L2Character::isNpc).forEach(mob -> mob.deleteMe());
ThreadPoolManager.schedule(() -> npc.decayMe(), 10000); ThreadPool.schedule(() -> npc.decayMe(), 10000);
_zoneLair.broadcastPacket(new OnEventTrigger(SECOND_STAGE_EVENT_TRIGGER, false)); _zoneLair.broadcastPacket(new OnEventTrigger(SECOND_STAGE_EVENT_TRIGGER, false));
_zoneLair.broadcastPacket(new OnEventTrigger(FIRST_STAGE_EVENT_TRIGGER, true)); _zoneLair.broadcastPacket(new OnEventTrigger(FIRST_STAGE_EVENT_TRIGGER, true));
_lionel.deleteMe(); _lionel.deleteMe();
@@ -846,7 +846,7 @@ public class Lindvior extends AbstractNpcAI
{ {
_zoneLair.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_GENERATOR_HAS_BEEN_DESTROYED, ExShowScreenMessage.TOP_CENTER, 5000, true)); _zoneLair.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_GENERATOR_HAS_BEEN_DESTROYED, ExShowScreenMessage.TOP_CENTER, 5000, true));
Clean(); Clean();
_collapseTask = ThreadPoolManager.schedule(() -> Fail(false), 20000); _collapseTask = ThreadPool.schedule(() -> Fail(false), 20000);
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }
@@ -882,7 +882,7 @@ public class Lindvior extends AbstractNpcAI
{ {
if (zone.getPlayersInside().isEmpty()) if (zone.getPlayersInside().isEmpty())
{ {
_collapseTask = ThreadPoolManager.schedule(() -> Fail(true), 900000); _collapseTask = ThreadPool.schedule(() -> Fail(true), 900000);
} }
} }
return super.onExitZone(character, zone); return super.onExitZone(character, zone);
@@ -940,7 +940,7 @@ public class Lindvior extends AbstractNpcAI
{ {
if (_socialTask == null) if (_socialTask == null)
{ {
_socialTask = ThreadPoolManager.schedule(() -> nextStage(1), 3000); _socialTask = ThreadPool.schedule(() -> nextStage(1), 3000);
} }
} }
} }
@@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.Config; 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.ai.CtrlIntention;
import com.l2jmobius.gameserver.instancemanager.GrandBossManager; import com.l2jmobius.gameserver.instancemanager.GrandBossManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager;
@@ -258,7 +258,7 @@ public final class QueenAnt extends AbstractNpcAI
{ {
((L2MonsterInstance) npc).getMinionList().spawnMinions(npc.getParameters().getMinionList("Privates")); ((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; break;
} }
} }
@@ -20,8 +20,8 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.DoorData; import com.l2jmobius.gameserver.data.xml.impl.DoorData;
import com.l2jmobius.gameserver.datatables.SpawnTable; import com.l2jmobius.gameserver.datatables.SpawnTable;
import com.l2jmobius.gameserver.enums.Movie; import com.l2jmobius.gameserver.enums.Movie;
@@ -429,7 +429,7 @@ public class Trasken extends AbstractNpcAI
doom.setTarget(doom); doom.setTarget(doom);
doom.isCastingNow(); doom.isCastingNow();
doom.doCast(SKILL_1.getSkill()); doom.doCast(SKILL_1.getSkill());
ThreadPoolManager.schedule(() -> doom.deleteMe(), 15000); ThreadPool.schedule(() -> doom.deleteMe(), 15000);
} }
final double percent = ((npc.getCurrentHp() - damage) / npc.getMaxHp()) * 100.0; final double percent = ((npc.getCurrentHp() - damage) / npc.getMaxHp()) * 100.0;
if ((percent <= 30) && (_statusZone == 4)) if ((percent <= 30) && (_statusZone == 4))
@@ -616,7 +616,7 @@ public class Trasken extends AbstractNpcAI
_zoneLair.getCharactersInside().stream().filter(L2Object::isMonster).forEach(cha -> ((L2MonsterInstance) cha).getSpawn().stopRespawn()); _zoneLair.getCharactersInside().stream().filter(L2Object::isMonster).forEach(cha -> ((L2MonsterInstance) cha).getSpawn().stopRespawn());
_zoneLair2.getCharactersInside().stream().filter(L2Character::isNpc).forEach(mob -> mob.deleteMe()); _zoneLair2.getCharactersInside().stream().filter(L2Character::isNpc).forEach(mob -> mob.deleteMe());
_zoneLair2.getCharactersInside().stream().filter(L2Object::isMonster).forEach(cha -> ((L2MonsterInstance) cha).getSpawn().stopRespawn()); _zoneLair2.getCharactersInside().stream().filter(L2Object::isMonster).forEach(cha -> ((L2MonsterInstance) cha).getSpawn().stopRespawn());
ThreadPoolManager.schedule(() -> npc.decayMe(), 10000); ThreadPool.schedule(() -> npc.decayMe(), 10000);
cancelQuestTimer("finish", npc, null); cancelQuestTimer("finish", npc, null);
GrandBossManager.getInstance().setBossStatus(TRASKEN, DEAD); GrandBossManager.getInstance().setBossStatus(TRASKEN, DEAD);
@@ -642,7 +642,7 @@ public class Trasken extends AbstractNpcAI
final int[] spawn = Rnd_Spawn_Tail[Rnd.get(Rnd_Spawn_Tail.length)]; final int[] spawn = Rnd_Spawn_Tail[Rnd.get(Rnd_Spawn_Tail.length)];
if (SpawnTable.getInstance().getSpawns(TAIL_TRASKEN) == null) if (SpawnTable.getInstance().getSpawns(TAIL_TRASKEN) == null)
{ {
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
tie_trasken = addSpawn(TAIL_TRASKEN, spawn[0], spawn[1], spawn[2], 0, false, 0, true); tie_trasken = addSpawn(TAIL_TRASKEN, spawn[0], spawn[1], spawn[2], 0, false, 0, true);
tie_trasken.setCurrentHp(hp_tail); tie_trasken.setCurrentHp(hp_tail);
@@ -663,7 +663,7 @@ public class Trasken extends AbstractNpcAI
final int[] spawn1 = Rnd_Spawn_Trasken[Rnd.get(Rnd_Spawn_Trasken.length)]; final int[] spawn1 = Rnd_Spawn_Trasken[Rnd.get(Rnd_Spawn_Trasken.length)];
if (SpawnTable.getInstance().getSpawns(TRASKEN) == null) if (SpawnTable.getInstance().getSpawns(TRASKEN) == null)
{ {
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
trasken = addSpawn(TRASKEN, spawn1[0], spawn1[1], spawn1[2], 0, false, 0, true); trasken = addSpawn(TRASKEN, spawn1[0], spawn1[1], spawn1[2], 0, false, 0, true);
trasken.doCast(SKILL_TRASKEN_UP.getSkill()); trasken.doCast(SKILL_TRASKEN_UP.getSkill());
@@ -774,7 +774,7 @@ public class Trasken extends AbstractNpcAI
} }
final int time = 540000; final int time = 540000;
zone.getPlayersInside().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 540, 0, NpcStringId.REMAINING_TIME))); zone.getPlayersInside().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 540, 0, NpcStringId.REMAINING_TIME)));
_collapseTask = ThreadPoolManager.schedule(() -> Fail(true), time); _collapseTask = ThreadPool.schedule(() -> Fail(true), time);
} }
return super.onEnterZone(character, zone); return super.onEnterZone(character, zone);
} }
@@ -784,7 +784,7 @@ public class Trasken extends AbstractNpcAI
{ {
if ((zone.getId() == ZONE_ID_HEART) && zone.getPlayersInside().isEmpty()) if ((zone.getId() == ZONE_ID_HEART) && zone.getPlayersInside().isEmpty())
{ {
_collapseTask = ThreadPoolManager.schedule(() -> _collapseTask = ThreadPool.schedule(() ->
{ {
Fail(true); Fail(true);
for (int info : eventTriggers) for (int info : eventTriggers)
@@ -890,7 +890,7 @@ public class Trasken extends AbstractNpcAI
character.getEffectList().stopSkillEffects(true, traskenBuff.getSkill()); character.getEffectList().stopSkillEffects(true, traskenBuff.getSkill());
} }
} }
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
character.broadcastPacket(new ExShowScreenMessage(NpcStringId.YOU_VE_EXCEEDED_THE_MAXIMUM_NUMBER_OF_PERSONNEL, 5, 24000, true)); character.broadcastPacket(new ExShowScreenMessage(NpcStringId.YOU_VE_EXCEEDED_THE_MAXIMUM_NUMBER_OF_PERSONNEL, 5, 24000, true));
character.doCast(SKILL_TRASKEN_SLEEP.getSkill()); character.doCast(SKILL_TRASKEN_SLEEP.getSkill());
@@ -20,8 +20,8 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.data.xml.impl.DoorData; import com.l2jmobius.gameserver.data.xml.impl.DoorData;
import com.l2jmobius.gameserver.instancemanager.GraciaSeedsManager; import com.l2jmobius.gameserver.instancemanager.GraciaSeedsManager;
@@ -721,7 +721,7 @@ public final class EnergySeeds extends AbstractNpcAI
public void scheduleRespawn(long waitTime) public void scheduleRespawn(long waitTime)
{ {
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
// if the AI is inactive, do not spawn the NPC // if the AI is inactive, do not spawn the NPC
if (isSeedActive(_seedId)) if (isSeedActive(_seedId))
@@ -18,7 +18,7 @@ package ai.others.NpcBuffers;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -90,6 +90,6 @@ public class NpcBufferAI implements Runnable
_npc.doCast(skill); _npc.doCast(skill);
ThreadPoolManager.schedule(this, skill.getReuseDelay()); ThreadPool.schedule(this, skill.getReuseDelay());
} }
} }
@@ -16,7 +16,7 @@
*/ */
package ai.others.NpcBuffers; package ai.others.NpcBuffers;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -53,7 +53,7 @@ public final class NpcBuffers extends AbstractNpcAI
final NpcBufferData data = _npcBuffers.getNpcBuffer(npc.getId()); final NpcBufferData data = _npcBuffers.getNpcBuffer(npc.getId());
for (NpcBufferSkillData skill : data.getSkills()) for (NpcBufferSkillData skill : data.getSkills())
{ {
ThreadPoolManager.schedule(new NpcBufferAI(npc, skill), skill.getInitialDelay()); ThreadPool.schedule(new NpcBufferAI(npc, skill), skill.getInitialDelay());
} }
return super.onSpawn(npc); return super.onSpawn(npc);
} }
@@ -19,7 +19,7 @@ package custom.events.Elpies;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.Config; 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.datatables.SpawnTable;
import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.L2Spawn;
import com.l2jmobius.gameserver.model.actor.L2Npc; 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("Help us exterminate them!");
Broadcast.toAllOnlinePlayers("You have " + EVENT_DURATION_MINUTES + " minutes!"); Broadcast.toAllOnlinePlayers("You have " + EVENT_DURATION_MINUTES + " minutes!");
_eventTask = ThreadPoolManager.schedule(() -> _eventTask = ThreadPool.schedule(() ->
{ {
Broadcast.toAllOnlinePlayers("Time is up!"); Broadcast.toAllOnlinePlayers("Time is up!");
eventStop(); eventStop();
@@ -22,7 +22,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.Config; 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.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.actor.L2Npc; 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..."); Broadcast.toAllOnlinePlayers("Visit Event Manager in Dion village and signup, you have " + _time_register + " min before Race Start...");
// Schedule Event end // Schedule Event end
_eventTask = ThreadPoolManager.schedule(() -> StartRace(), _time_register * 60 * 1000); _eventTask = ThreadPool.schedule(() -> StartRace(), _time_register * 60 * 1000);
return true; return true;
@@ -181,7 +181,7 @@ public final class Race extends Event
} }
} }
// Schedule timeup for Race // Schedule timeup for Race
_eventTask = ThreadPoolManager.schedule(() -> timeUp(), _time_race * 60 * 1000); _eventTask = ThreadPool.schedule(() -> timeUp(), _time_race * 60 * 1000);
} }
@Override @Override
@@ -16,8 +16,8 @@
*/ */
package handlers.admincommandhandlers; package handlers.admincommandhandlers;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.MonsterRace; import com.l2jmobius.gameserver.MonsterRace;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler; import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.SystemMessageId;
@@ -107,7 +107,7 @@ public class AdminMonsterRace implements IAdminCommandHandler
activeChar.sendPacket(spk); activeChar.sendPacket(spk);
activeChar.broadcastPacket(spk); activeChar.broadcastPacket(spk);
ThreadPoolManager.schedule(new RunRace(codes, activeChar), 5000); ThreadPool.schedule(new RunRace(codes, activeChar), 5000);
} }
} }
@@ -137,7 +137,7 @@ public class AdminMonsterRace implements IAdminCommandHandler
final MonRaceInfo spk = new MonRaceInfo(codes[2][0], codes[2][1], MonsterRace.getInstance().getMonsters(), MonsterRace.getInstance().getSpeeds()); final MonRaceInfo spk = new MonRaceInfo(codes[2][0], codes[2][1], MonsterRace.getInstance().getMonsters(), MonsterRace.getInstance().getSpeeds());
activeChar.sendPacket(spk); activeChar.sendPacket(spk);
activeChar.broadcastPacket(spk); activeChar.broadcastPacket(spk);
ThreadPoolManager.schedule(new RunEnd(activeChar), 30000); ThreadPool.schedule(new RunEnd(activeChar), 30000);
} }
} }
@@ -20,7 +20,7 @@ import java.util.NoSuchElementException;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import com.l2jmobius.Config; 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.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler; import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
@@ -46,7 +46,7 @@ public class AdminTest implements IAdminCommandHandler
{ {
if (command.equals("admin_stats")) if (command.equals("admin_stats"))
{ {
for (String line : ThreadPoolManager.getStats()) for (String line : ThreadPool.getStats())
{ {
activeChar.sendMessage(line); activeChar.sendMessage(line);
} }
@@ -16,7 +16,7 @@
*/ */
package handlers.effecthandlers; 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.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.SubclassInfoType; import com.l2jmobius.gameserver.enums.SubclassInfoType;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
@@ -57,7 +57,7 @@ public class ClassChange extends AbstractEffect
{ {
final L2PcInstance player = effected.getActingPlayer(); final L2PcInstance player = effected.getActingPlayer();
// TODO: FIX ME - Executing 1 second later otherwise interupted exception during storeCharBase() // TODO: FIX ME - Executing 1 second later otherwise interupted exception during storeCharBase()
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
final int activeClass = player.getClassId().getId(); final int activeClass = player.getClassId().getId();
@@ -16,7 +16,7 @@
*/ */
package handlers.playeractions; 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.CtrlEvent;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.ai.NextAction; import com.l2jmobius.gameserver.ai.NextAction;
@@ -129,7 +129,7 @@ public final class SocialAction implements IPlayerActionHandler
player.sendPacket(sm); player.sendPacket(sm);
if (!player.isProcessingRequest()) if (!player.isProcessingRequest())
{ {
ThreadPoolManager.schedule(() -> scheduleDeny(player), 10000); ThreadPool.schedule(() -> scheduleDeny(player), 10000);
player.blockRequest(); player.blockRequest();
} }
return; return;
@@ -16,8 +16,8 @@
*/ */
package handlers.punishmenthandlers; package handlers.punishmenthandlers;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.LoginServerThread; import com.l2jmobius.gameserver.LoginServerThread;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.cache.HtmCache; import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IPunishmentHandler; import com.l2jmobius.gameserver.handler.IPunishmentHandler;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
@@ -162,7 +162,7 @@ public class JailHandler implements IPunishmentHandler
OlympiadManager.getInstance().removeDisconnectedCompetitor(player); 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 // Open a Html message to inform the player
final NpcHtmlMessage msg = new NpcHtmlMessage(); final NpcHtmlMessage msg = new NpcHtmlMessage();
@@ -198,7 +198,7 @@ public class JailHandler implements IPunishmentHandler
*/ */
private static void removeFromPlayer(L2PcInstance player) 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 // Open a Html message to inform the player
final NpcHtmlMessage msg = new NpcHtmlMessage(); final NpcHtmlMessage msg = new NpcHtmlMessage();
@@ -34,10 +34,10 @@ import java.util.Map.Entry;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.GameServer; import com.l2jmobius.gameserver.GameServer;
import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.LoginServerThread; import com.l2jmobius.gameserver.LoginServerThread;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.AdminData; import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.enums.ItemLocation; import com.l2jmobius.gameserver.enums.ItemLocation;
import com.l2jmobius.gameserver.model.L2Object; 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"); 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(line);
sb.append("\r\n"); sb.append("\r\n");
@@ -17,7 +17,7 @@
package handlers.telnethandlers.server; package handlers.telnethandlers.server;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand; import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
@@ -44,7 +44,7 @@ public class Performance implements ITelnetCommand
{ {
// ThreadPoolManager.purge(); // ThreadPoolManager.purge();
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
for (String line : ThreadPoolManager.getStats()) for (String line : ThreadPool.getStats())
{ {
sb.append(line + Config.EOL); sb.append(line + Config.EOL);
} }
@@ -17,7 +17,7 @@
package handlers.telnethandlers.server; package handlers.telnethandlers.server;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand; import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
@@ -42,9 +42,9 @@ public class Purge implements ITelnetCommand
@Override @Override
public String handle(ChannelHandlerContext ctx, String[] args) 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); 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); sb.append(line + Config.EOL);
} }
@@ -20,7 +20,7 @@ import java.util.HashMap;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import com.l2jmobius.Config; 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.handler.IVoicedCommandHandler;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.tasks.player.AutoPotionTask; 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.get(playerOID).cancel(true);
AUTO_POTION_TASKS.remove(playerOID); 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."); activeChar.sendMessage("Auto potions is enabled.");
return true; return true;
} }
@@ -23,8 +23,8 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.enums.QuestSound; import com.l2jmobius.gameserver.enums.QuestSound;
import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -202,7 +202,7 @@ public final class CastleDungeon extends AbstractInstance
*/ */
private void spawnRaid(Instance instance) private void spawnRaid(Instance instance)
{ {
final ScheduledFuture<?> spawnTask = ThreadPoolManager.schedule(() -> final ScheduledFuture<?> spawnTask = ThreadPool.schedule(() ->
{ {
// Get template id of raid // Get template id of raid
final int npcId; final int npcId;
@@ -25,8 +25,8 @@ import java.util.logging.Level;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
@@ -111,7 +111,7 @@ public final class ChamberOfDelusion extends AbstractInstance
changeRoom(instance); changeRoom(instance);
// Start banish task // Start banish task
final ScheduledFuture<?> banishTask = ThreadPoolManager.scheduleAtFixedRate(() -> final ScheduledFuture<?> banishTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
if (instance.getRemainingTime() < 60000) if (instance.getRemainingTime() < 60000)
{ {
@@ -414,7 +414,7 @@ public final class ChamberOfDelusion extends AbstractInstance
final long nextInterval = (bossRoom) ? 60000L : (ROOM_CHANGE_INTERVAL + getRandom(ROOM_CHANGE_RANDOM_TIME)) * 1000L; final long nextInterval = (bossRoom) ? 60000L : (ROOM_CHANGE_INTERVAL + getRandom(ROOM_CHANGE_RANDOM_TIME)) * 1000L;
if (world.getRemainingTime() > nextInterval) if (world.getRemainingTime() > nextInterval)
{ {
final ScheduledFuture<?> roomChangeTask = ThreadPoolManager.schedule(() -> final ScheduledFuture<?> roomChangeTask = ThreadPool.schedule(() ->
{ {
try try
{ {
@@ -23,8 +23,8 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.enums.QuestSound; import com.l2jmobius.gameserver.enums.QuestSound;
import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -225,7 +225,7 @@ public final class FortressDungeon extends AbstractInstance
*/ */
private void spawnRaid(Instance instance) private void spawnRaid(Instance instance)
{ {
final ScheduledFuture<?> spawnTask = ThreadPoolManager.schedule(() -> final ScheduledFuture<?> spawnTask = ThreadPool.schedule(() ->
{ {
// Get template id of raid // Get template id of raid
final int npcId; final int npcId;
@@ -16,8 +16,8 @@
*/ */
package quests.Q10292_SevenSignsGirlOfDoubt; package quests.Q10292_SevenSignsGirlOfDoubt;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.enums.QuestSound; import com.l2jmobius.gameserver.enums.QuestSound;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -168,7 +168,7 @@ public final class Q10292_SevenSignsGirlOfDoubt extends Quest
creature1.setRandomWalking(true); creature1.setRandomWalking(true);
final L2Npc creature2 = addSpawn(CREATURE_OF_THE_DUSK2, 89524, -238131, -9632, 56, false, 0, false, player.getInstanceId()); final L2Npc creature2 = addSpawn(CREATURE_OF_THE_DUSK2, 89524, -238131, -9632, 56, false, 0, false, player.getInstanceId());
creature2.setRandomWalking(true); creature2.setRandomWalking(true);
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
creature1.deleteMe(); creature1.deleteMe();
creature2.deleteMe(); creature2.deleteMe();
@@ -16,7 +16,7 @@
*/ */
package quests.Q10742_AFurryFriend; package quests.Q10742_AFurryFriend;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.instancemanager.WalkingManager; import com.l2jmobius.gameserver.instancemanager.WalkingManager;
@@ -228,6 +228,6 @@ public final class Q10742_AFurryFriend extends Quest
public void onRouteFinished(L2Npc npc) public void onRouteFinished(L2Npc npc)
{ {
WalkingManager.getInstance().cancelMoving(npc); WalkingManager.getInstance().cancelMoving(npc);
ThreadPoolManager.schedule(() -> npc.deleteMe(), 1000); ThreadPool.schedule(() -> npc.deleteMe(), 1000);
} }
} }
@@ -19,7 +19,7 @@ package vehicles;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.Movie; import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.instancemanager.AirShipManager; import com.l2jmobius.gameserver.instancemanager.AirShipManager;
@@ -291,11 +291,11 @@ public abstract class AirShipController extends AbstractNpcAI
playMovie(_dockedShip.getPassengers(), _movie); playMovie(_dockedShip.getPassengers(), _movie);
} }
ThreadPoolManager.schedule(_decayTask, 1000); ThreadPool.schedule(_decayTask, 1000);
} }
else else
{ {
_departSchedule = ThreadPoolManager.schedule(_departTask, DEPART_INTERVAL); _departSchedule = ThreadPool.schedule(_departTask, DEPART_INTERVAL);
} }
} }
} }
@@ -16,7 +16,7 @@
*/ */
package vehicles.AirShipGludioGracia; package vehicles.AirShipGludioGracia;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.instancemanager.AirShipManager; import com.l2jmobius.gameserver.instancemanager.AirShipManager;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
@@ -251,7 +251,7 @@ public final class AirShipGludioGracia extends AbstractNpcAI implements Runnable
{ {
// _ship.teleToLocation(-167874, 256731, -509, 41035, false); // _ship.teleToLocation(-167874, 256731, -509, 41035, false);
_ship.setOustLoc(OUST_GRACIA); _ship.setOustLoc(OUST_GRACIA);
ThreadPoolManager.schedule(this, 5000); ThreadPool.schedule(this, 5000);
break; break;
} }
case 2: case 2:
@@ -264,7 +264,7 @@ public final class AirShipGludioGracia extends AbstractNpcAI implements Runnable
broadcastInGracia(NpcStringId.THE_REGULARLY_SCHEDULED_AIRSHIP_HAS_ARRIVED_IT_WILL_DEPART_FOR_THE_ADEN_CONTINENT_IN_1_MINUTE); broadcastInGracia(NpcStringId.THE_REGULARLY_SCHEDULED_AIRSHIP_HAS_ARRIVED_IT_WILL_DEPART_FOR_THE_ADEN_CONTINENT_IN_1_MINUTE);
_ship.setInDock(GRACIA_DOCK_ID); _ship.setInDock(GRACIA_DOCK_ID);
_ship.oustPlayers(); _ship.oustPlayers();
ThreadPoolManager.schedule(this, 60000); ThreadPool.schedule(this, 60000);
break; break;
} }
case 4: case 4:
@@ -278,7 +278,7 @@ public final class AirShipGludioGracia extends AbstractNpcAI implements Runnable
{ {
// _ship.teleToLocation(-157261, 255664, 221, 64781, false); // _ship.teleToLocation(-157261, 255664, 221, 64781, false);
_ship.setOustLoc(OUST_GLUDIO); _ship.setOustLoc(OUST_GLUDIO);
ThreadPoolManager.schedule(this, 5000); ThreadPool.schedule(this, 5000);
break; break;
} }
case 6: case 6:
@@ -291,7 +291,7 @@ public final class AirShipGludioGracia extends AbstractNpcAI implements Runnable
broadcastInGludio(NpcStringId.THE_REGULARLY_SCHEDULED_AIRSHIP_HAS_ARRIVED_IT_WILL_DEPART_FOR_THE_GRACIA_CONTINENT_IN_1_MINUTE); broadcastInGludio(NpcStringId.THE_REGULARLY_SCHEDULED_AIRSHIP_HAS_ARRIVED_IT_WILL_DEPART_FOR_THE_GRACIA_CONTINENT_IN_1_MINUTE);
_ship.setInDock(GLUDIO_DOCK_ID); _ship.setInDock(GLUDIO_DOCK_ID);
_ship.oustPlayers(); _ship.oustPlayers();
ThreadPoolManager.schedule(this, 60000); ThreadPool.schedule(this, 60000);
break; break;
} }
} }
@@ -18,7 +18,7 @@ package vehicles;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.instancemanager.BoatManager; import com.l2jmobius.gameserver.instancemanager.BoatManager;
import com.l2jmobius.gameserver.model.VehiclePathPoint; import com.l2jmobius.gameserver.model.VehiclePathPoint;
@@ -176,19 +176,19 @@ public class BoatGludinRune implements Runnable
case 0: case 0:
{ {
BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], LEAVE_GLUDIN5); BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], LEAVE_GLUDIN5);
ThreadPoolManager.schedule(this, 240000); ThreadPool.schedule(this, 240000);
break; break;
} }
case 1: case 1:
{ {
BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], LEAVE_GLUDIN1); BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], LEAVE_GLUDIN1);
ThreadPoolManager.schedule(this, 40000); ThreadPool.schedule(this, 40000);
break; break;
} }
case 2: case 2:
{ {
BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], LEAVE_GLUDIN0); BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], LEAVE_GLUDIN0);
ThreadPoolManager.schedule(this, 20000); ThreadPool.schedule(this, 20000);
break; break;
} }
case 3: case 3:
@@ -198,25 +198,25 @@ public class BoatGludinRune implements Runnable
_boat.broadcastPacket(GLUDIN_SOUND); _boat.broadcastPacket(GLUDIN_SOUND);
_boat.payForRide(7905, 1, -90015, 150422, -3610); _boat.payForRide(7905, 1, -90015, 150422, -3610);
_boat.executePath(GLUDIN_TO_RUNE); _boat.executePath(GLUDIN_TO_RUNE);
ThreadPoolManager.schedule(this, 250000); ThreadPool.schedule(this, 250000);
break; break;
} }
case 4: case 4:
{ {
BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], ARRIVAL_RUNE15); BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], ARRIVAL_RUNE15);
ThreadPoolManager.schedule(this, 300000); ThreadPool.schedule(this, 300000);
break; break;
} }
case 5: case 5:
{ {
BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], ARRIVAL_RUNE10); BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], ARRIVAL_RUNE10);
ThreadPoolManager.schedule(this, 300000); ThreadPool.schedule(this, 300000);
break; break;
} }
case 6: case 6:
{ {
BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], ARRIVAL_RUNE5); BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], ARRIVAL_RUNE5);
ThreadPoolManager.schedule(this, 240000); ThreadPool.schedule(this, 240000);
break; break;
} }
case 7: case 7:
@@ -239,7 +239,7 @@ public class BoatGludinRune implements Runnable
_shoutCount = 0; _shoutCount = 0;
} }
ThreadPoolManager.schedule(this, 5000); ThreadPool.schedule(this, 5000);
return; return;
} }
_boat.executePath(RUNE_DOCK); _boat.executePath(RUNE_DOCK);
@@ -250,25 +250,25 @@ public class BoatGludinRune implements Runnable
BoatManager.getInstance().dockShip(BoatManager.RUNE_HARBOR, true); BoatManager.getInstance().dockShip(BoatManager.RUNE_HARBOR, true);
BoatManager.getInstance().broadcastPackets(RUNE_DOCK[0], GLUDIN_DOCK[0], ARRIVED_AT_RUNE, ARRIVED_AT_RUNE_2); BoatManager.getInstance().broadcastPackets(RUNE_DOCK[0], GLUDIN_DOCK[0], ARRIVED_AT_RUNE, ARRIVED_AT_RUNE_2);
_boat.broadcastPacket(RUNE_SOUND); _boat.broadcastPacket(RUNE_SOUND);
ThreadPoolManager.schedule(this, 300000); ThreadPool.schedule(this, 300000);
break; break;
} }
case 10: case 10:
{ {
BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], LEAVE_RUNE5); BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], LEAVE_RUNE5);
ThreadPoolManager.schedule(this, 240000); ThreadPool.schedule(this, 240000);
break; break;
} }
case 11: case 11:
{ {
BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], LEAVE_RUNE1); BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], LEAVE_RUNE1);
ThreadPoolManager.schedule(this, 40000); ThreadPool.schedule(this, 40000);
break; break;
} }
case 12: case 12:
{ {
BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], LEAVE_RUNE0); BoatManager.getInstance().broadcastPacket(RUNE_DOCK[0], GLUDIN_DOCK[0], LEAVE_RUNE0);
ThreadPoolManager.schedule(this, 20000); ThreadPool.schedule(this, 20000);
break; break;
} }
case 13: case 13:
@@ -278,25 +278,25 @@ public class BoatGludinRune implements Runnable
_boat.broadcastPacket(RUNE_SOUND); _boat.broadcastPacket(RUNE_SOUND);
_boat.payForRide(7904, 1, 34513, -38009, -3640); _boat.payForRide(7904, 1, 34513, -38009, -3640);
_boat.executePath(RUNE_TO_GLUDIN); _boat.executePath(RUNE_TO_GLUDIN);
ThreadPoolManager.schedule(this, 60000); ThreadPool.schedule(this, 60000);
break; break;
} }
case 14: case 14:
{ {
BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], ARRIVAL_GLUDIN15); BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], ARRIVAL_GLUDIN15);
ThreadPoolManager.schedule(this, 300000); ThreadPool.schedule(this, 300000);
break; break;
} }
case 15: case 15:
{ {
BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], ARRIVAL_GLUDIN10); BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], ARRIVAL_GLUDIN10);
ThreadPoolManager.schedule(this, 300000); ThreadPool.schedule(this, 300000);
break; break;
} }
case 16: case 16:
{ {
BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], ARRIVAL_GLUDIN5); BoatManager.getInstance().broadcastPacket(GLUDIN_DOCK[0], RUNE_DOCK[0], ARRIVAL_GLUDIN5);
ThreadPoolManager.schedule(this, 240000); ThreadPool.schedule(this, 240000);
break; break;
} }
case 17: case 17:
@@ -319,7 +319,7 @@ public class BoatGludinRune implements Runnable
_shoutCount = 0; _shoutCount = 0;
} }
ThreadPoolManager.schedule(this, 5000); ThreadPool.schedule(this, 5000);
return; return;
} }
_boat.executePath(GLUDIN_DOCK); _boat.executePath(GLUDIN_DOCK);
@@ -330,7 +330,7 @@ public class BoatGludinRune implements Runnable
BoatManager.getInstance().dockShip(BoatManager.GLUDIN_HARBOR, true); BoatManager.getInstance().dockShip(BoatManager.GLUDIN_HARBOR, true);
BoatManager.getInstance().broadcastPackets(GLUDIN_DOCK[0], RUNE_DOCK[0], ARRIVED_AT_GLUDIN, ARRIVED_AT_GLUDIN_2); BoatManager.getInstance().broadcastPackets(GLUDIN_DOCK[0], RUNE_DOCK[0], ARRIVED_AT_GLUDIN, ARRIVED_AT_GLUDIN_2);
_boat.broadcastPacket(GLUDIN_SOUND); _boat.broadcastPacket(GLUDIN_SOUND);
ThreadPoolManager.schedule(this, 300000); ThreadPool.schedule(this, 300000);
break; break;
} }
} }
@@ -18,7 +18,7 @@ package vehicles;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.instancemanager.BoatManager; import com.l2jmobius.gameserver.instancemanager.BoatManager;
import com.l2jmobius.gameserver.model.VehiclePathPoint; import com.l2jmobius.gameserver.model.VehiclePathPoint;
@@ -119,19 +119,19 @@ public class BoatInnadrilTour implements Runnable
case 0: case 0:
{ {
BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL5); BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL5);
ThreadPoolManager.schedule(this, 240000); ThreadPool.schedule(this, 240000);
break; break;
} }
case 1: case 1:
{ {
BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL1); BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL1);
ThreadPoolManager.schedule(this, 40000); ThreadPool.schedule(this, 40000);
break; break;
} }
case 2: case 2:
{ {
BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL0); BoatManager.getInstance().broadcastPacket(DOCK, DOCK, LEAVE_INNADRIL0);
ThreadPoolManager.schedule(this, 20000); ThreadPool.schedule(this, 20000);
break; break;
} }
case 3: case 3:
@@ -139,31 +139,31 @@ public class BoatInnadrilTour implements Runnable
BoatManager.getInstance().broadcastPackets(DOCK, DOCK, LEAVING_INNADRIL, INNADRIL_SOUND); BoatManager.getInstance().broadcastPackets(DOCK, DOCK, LEAVING_INNADRIL, INNADRIL_SOUND);
_boat.payForRide(0, 1, 107092, 219098, -3952); _boat.payForRide(0, 1, 107092, 219098, -3952);
_boat.executePath(TOUR); _boat.executePath(TOUR);
ThreadPoolManager.schedule(this, 650000); ThreadPool.schedule(this, 650000);
break; break;
} }
case 4: case 4:
{ {
BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL20); BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL20);
ThreadPoolManager.schedule(this, 300000); ThreadPool.schedule(this, 300000);
break; break;
} }
case 5: case 5:
{ {
BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL15); BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL15);
ThreadPoolManager.schedule(this, 300000); ThreadPool.schedule(this, 300000);
break; break;
} }
case 6: case 6:
{ {
BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL10); BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL10);
ThreadPoolManager.schedule(this, 300000); ThreadPool.schedule(this, 300000);
break; break;
} }
case 7: case 7:
{ {
BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL5); BoatManager.getInstance().broadcastPacket(DOCK, DOCK, ARRIVAL5);
ThreadPoolManager.schedule(this, 240000); ThreadPool.schedule(this, 240000);
break; break;
} }
case 8: case 8:
@@ -174,7 +174,7 @@ public class BoatInnadrilTour implements Runnable
case 9: case 9:
{ {
BoatManager.getInstance().broadcastPackets(DOCK, DOCK, ARRIVED_AT_INNADRIL, INNADRIL_SOUND); BoatManager.getInstance().broadcastPackets(DOCK, DOCK, ARRIVED_AT_INNADRIL, INNADRIL_SOUND);
ThreadPoolManager.schedule(this, 300000); ThreadPool.schedule(this, 300000);
break; break;
} }
} }
@@ -18,7 +18,7 @@ package vehicles;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.instancemanager.BoatManager; import com.l2jmobius.gameserver.instancemanager.BoatManager;
import com.l2jmobius.gameserver.model.VehiclePathPoint; import com.l2jmobius.gameserver.model.VehiclePathPoint;
@@ -120,7 +120,7 @@ public class BoatRunePrimeval implements Runnable
case 1: case 1:
{ {
BoatManager.getInstance().broadcastPackets(PRIMEVAL_DOCK, RUNE_DOCK[0], ARRIVED_AT_PRIMEVAL, ARRIVED_AT_PRIMEVAL_2, PRIMEVAL_SOUND); BoatManager.getInstance().broadcastPackets(PRIMEVAL_DOCK, RUNE_DOCK[0], ARRIVED_AT_PRIMEVAL, ARRIVED_AT_PRIMEVAL_2, PRIMEVAL_SOUND);
ThreadPoolManager.schedule(this, 180000); ThreadPool.schedule(this, 180000);
break; break;
} }
case 2: case 2:
@@ -145,7 +145,7 @@ public class BoatRunePrimeval implements Runnable
_shoutCount = 0; _shoutCount = 0;
} }
ThreadPoolManager.schedule(this, 5000); ThreadPool.schedule(this, 5000);
return; return;
} }
_boat.executePath(RUNE_DOCK); _boat.executePath(RUNE_DOCK);
@@ -155,7 +155,7 @@ public class BoatRunePrimeval implements Runnable
{ {
BoatManager.getInstance().dockShip(BoatManager.RUNE_HARBOR, true); BoatManager.getInstance().dockShip(BoatManager.RUNE_HARBOR, true);
BoatManager.getInstance().broadcastPackets(RUNE_DOCK[0], PRIMEVAL_DOCK, ARRIVED_AT_RUNE, ARRIVED_AT_RUNE_2, RUNE_SOUND); BoatManager.getInstance().broadcastPackets(RUNE_DOCK[0], PRIMEVAL_DOCK, ARRIVED_AT_RUNE, ARRIVED_AT_RUNE_2, RUNE_SOUND);
ThreadPoolManager.schedule(this, 180000); ThreadPool.schedule(this, 180000);
break; break;
} }
} }
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.l2jmobius.gameserver; package com.l2jmobius.commons.concurrent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -37,9 +37,9 @@ import com.l2jmobius.Config;
* <li>Instant pool handles short-life events.</li> * <li>Instant pool handles short-life events.</li>
* </ul> * </ul>
*/ */
public final class ThreadPoolManager public final class ThreadPool
{ {
protected static final Logger LOG = Logger.getLogger(ThreadPoolManager.class.getName()); protected static final Logger LOG = Logger.getLogger(ThreadPool.class.getName());
private static final long MAX_DELAY = TimeUnit.NANOSECONDS.toMillis(Long.MAX_VALUE - System.nanoTime()) / 2; private static final long MAX_DELAY = TimeUnit.NANOSECONDS.toMillis(Long.MAX_VALUE - System.nanoTime()) / 2;
@@ -29,6 +29,7 @@ import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.Server; import com.l2jmobius.Server;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.DeadLockDetector; import com.l2jmobius.commons.util.DeadLockDetector;
import com.l2jmobius.gameserver.cache.HtmCache; import com.l2jmobius.gameserver.cache.HtmCache;
@@ -179,7 +180,7 @@ public class GameServer
} }
printSection("ThreadPool"); printSection("ThreadPool");
ThreadPoolManager.init(); ThreadPool.init();
EventDispatcher.getInstance(); EventDispatcher.getInstance();
// load script engines // load script engines
@@ -21,6 +21,7 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.ItemLocation; import com.l2jmobius.gameserver.enums.ItemLocation;
import com.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import com.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
@@ -31,7 +32,7 @@ public final class ItemsAutoDestroy
protected ItemsAutoDestroy() protected ItemsAutoDestroy()
{ {
ThreadPoolManager.scheduleAtFixedRate(this::removeItems, 5000, 5000); ThreadPool.scheduleAtFixedRate(this::removeItems, 5000, 5000);
} }
public static ItemsAutoDestroy getInstance() public static ItemsAutoDestroy getInstance()
@@ -24,6 +24,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.data.xml.impl.RecipeData; import com.l2jmobius.gameserver.data.xml.impl.RecipeData;
import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.datatables.ItemTable;
@@ -109,7 +110,7 @@ public class RecipeController
if (Config.ALT_GAME_CREATION) if (Config.ALT_GAME_CREATION)
{ {
_activeMakers.put(manufacturer.getObjectId(), maker); _activeMakers.put(manufacturer.getObjectId(), maker);
ThreadPoolManager.schedule(maker, 100); ThreadPool.schedule(maker, 100);
} }
else else
{ {
@@ -158,7 +159,7 @@ public class RecipeController
if (Config.ALT_GAME_CREATION) if (Config.ALT_GAME_CREATION)
{ {
_activeMakers.put(player.getObjectId(), maker); _activeMakers.put(player.getObjectId(), maker);
ThreadPoolManager.schedule(maker, 100); ThreadPool.schedule(maker, 100);
} }
else else
{ {
@@ -354,7 +355,7 @@ public class RecipeController
_player.broadcastPacket(msk); _player.broadcastPacket(msk);
_player.sendPacket(new SetupGauge(_player.getObjectId(), 0, _delay)); _player.sendPacket(new SetupGauge(_player.getObjectId(), 0, _delay));
ThreadPoolManager.schedule(this, 100 + _delay); ThreadPool.schedule(this, 100 + _delay);
} }
else else
{ {
@@ -548,7 +549,7 @@ public class RecipeController
if (Config.ALT_GAME_CREATION && isWait) if (Config.ALT_GAME_CREATION && isWait)
{ {
_player.sendPacket(new SetupGauge(_player.getObjectId(), 0, _delay)); _player.sendPacket(new SetupGauge(_player.getObjectId(), 0, _delay));
ThreadPoolManager.schedule(this, 100 + _delay); ThreadPool.schedule(this, 100 + _delay);
} }
else else
{ {
@@ -570,7 +571,7 @@ public class RecipeController
if (Config.ALT_GAME_CREATION && isWait) if (Config.ALT_GAME_CREATION && isWait)
{ {
_player.sendPacket(new SetupGauge(_player.getObjectId(), 0, _delay)); _player.sendPacket(new SetupGauge(_player.getObjectId(), 0, _delay));
ThreadPoolManager.schedule(this, 100 + _delay); ThreadPool.schedule(this, 100 + _delay);
} }
else else
{ {
@@ -20,6 +20,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
import com.l2jmobius.gameserver.data.sql.impl.OfflineTradersTable; import com.l2jmobius.gameserver.data.sql.impl.OfflineTradersTable;
@@ -214,7 +215,7 @@ public class Shutdown extends Thread
// stop all thread pools // stop all thread pools
try try
{ {
ThreadPoolManager.shutdown(); ThreadPool.shutdown();
LOGGER.info("Thread Pool Manager: Manager has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); LOGGER.info("Thread Pool Manager: Manager has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
} }
catch (Throwable t) catch (Throwable t)
@@ -23,9 +23,9 @@ import static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -728,7 +728,7 @@ public abstract class AbstractAI implements Ctrl
setTarget(target); setTarget(target);
final int followRange = range == -1 ? Rnd.get(50, 100) : range; final int followRange = range == -1 ? Rnd.get(50, 100) : range;
_followTask = ThreadPoolManager.scheduleAtFixedRate(() -> _followTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
try try
{ {
@@ -29,9 +29,9 @@ import java.util.logging.Logger;
import java.util.stream.Stream; import java.util.stream.Stream;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.enums.AISkillScope; import com.l2jmobius.gameserver.enums.AISkillScope;
import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import com.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
@@ -206,7 +206,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
// If not idle - create an AI task (schedule onEvtThink repeatedly) // If not idle - create an AI task (schedule onEvtThink repeatedly)
if (_aiTask == null) if (_aiTask == null)
{ {
_aiTask = ThreadPoolManager.scheduleAtFixedRate(this, 1000, 1000); _aiTask = ThreadPool.scheduleAtFixedRate(this, 1000, 1000);
} }
} }
@@ -31,7 +31,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.ItemLocation; import com.l2jmobius.gameserver.enums.ItemLocation;
import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.instancemanager.WalkingManager; import com.l2jmobius.gameserver.instancemanager.WalkingManager;
@@ -308,7 +308,7 @@ public class L2CharacterAI extends AbstractAI
if (_actor.isAttackingNow()) if (_actor.isAttackingNow())
{ {
ThreadPoolManager.schedule(new CastTask(_actor, skill, target, item, forceUse, dontMove), _actor.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis())); ThreadPool.schedule(new CastTask(_actor, skill, target, item, forceUse, dontMove), _actor.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
} }
else else
{ {
@@ -16,7 +16,7 @@
*/ */
package com.l2jmobius.gameserver.ai; package com.l2jmobius.gameserver.ai;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.Location;
@@ -89,7 +89,7 @@ public class L2DoorAI extends L2CharacterAI
@Override @Override
protected void onEvtAttacked(L2Character attacker) protected void onEvtAttacked(L2Character attacker)
{ {
ThreadPoolManager.execute(new onEventAttackedDoorTask((L2DoorInstance) _actor, attacker)); ThreadPool.execute(new onEventAttackedDoorTask((L2DoorInstance) _actor, attacker));
} }
@Override @Override
@@ -22,8 +22,8 @@ import static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -342,7 +342,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
{ {
if (_avoidTask == null) if (_avoidTask == null)
{ {
_avoidTask = ThreadPoolManager.scheduleAtFixedRate(this, 100, 100); _avoidTask = ThreadPool.scheduleAtFixedRate(this, 100, 100);
} }
} }
@@ -20,7 +20,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/** /**
@@ -33,7 +33,7 @@ public class WarehouseCacheManager
protected WarehouseCacheManager() protected WarehouseCacheManager()
{ {
ThreadPoolManager.scheduleAtFixedRate(new CacheScheduler(), 120000, 60000); ThreadPool.scheduleAtFixedRate(new CacheScheduler(), 120000, 60000);
} }
public void addCacheTask(L2PcInstance pc) public void addCacheTask(L2PcInstance pc)
@@ -29,8 +29,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager; import com.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager;
import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData;
import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.enums.UserInfoType;
@@ -331,7 +331,7 @@ public class ClanTable
public void scheduleRemoveClan(int clanId) public void scheduleRemoveClan(int clanId)
{ {
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
if (getClan(clanId) == null) if (getClan(clanId) == null)
{ {
@@ -36,8 +36,8 @@ import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
@@ -425,11 +425,11 @@ public final class BotReportTable
c.set(Calendar.DAY_OF_YEAR, c.get(Calendar.DAY_OF_YEAR) + 1); c.set(Calendar.DAY_OF_YEAR, c.get(Calendar.DAY_OF_YEAR) + 1);
} }
ThreadPoolManager.schedule(new ResetPointTask(), c.getTimeInMillis() - System.currentTimeMillis()); ThreadPool.schedule(new ResetPointTask(), c.getTimeInMillis() - System.currentTimeMillis());
} }
catch (Exception e) catch (Exception e)
{ {
ThreadPoolManager.schedule(new ResetPointTask(), 24 * 3600 * 1000); ThreadPool.schedule(new ResetPointTask(), 24 * 3600 * 1000);
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Could not properly schedule bot report points reset task. Scheduled in 24 hours.", e); LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Could not properly schedule bot report points reset task. Scheduled in 24 hours.", e);
} }
} }
@@ -29,8 +29,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.engines.DocumentEngine; import com.l2jmobius.gameserver.engines.DocumentEngine;
import com.l2jmobius.gameserver.enums.ItemLocation; import com.l2jmobius.gameserver.enums.ItemLocation;
@@ -222,14 +222,14 @@ public class ItemTable
if ((raid.getFirstCommandChannelAttacked() != null) && !Config.AUTO_LOOT_RAIDS) if ((raid.getFirstCommandChannelAttacked() != null) && !Config.AUTO_LOOT_RAIDS)
{ {
item.setOwnerId(raid.getFirstCommandChannelAttacked().getLeaderObjectId()); item.setOwnerId(raid.getFirstCommandChannelAttacked().getLeaderObjectId());
itemLootShedule = ThreadPoolManager.schedule(new ResetOwner(item), Config.LOOT_RAIDS_PRIVILEGE_INTERVAL); itemLootShedule = ThreadPool.schedule(new ResetOwner(item), Config.LOOT_RAIDS_PRIVILEGE_INTERVAL);
item.setItemLootShedule(itemLootShedule); item.setItemLootShedule(itemLootShedule);
} }
} }
else if (!Config.AUTO_LOOT || ((reference instanceof L2EventMonsterInstance) && ((L2EventMonsterInstance) reference).eventDropOnGround())) else if (!Config.AUTO_LOOT || ((reference instanceof L2EventMonsterInstance) && ((L2EventMonsterInstance) reference).eventDropOnGround()))
{ {
item.setOwnerId(actor.getObjectId()); item.setOwnerId(actor.getObjectId());
itemLootShedule = ThreadPoolManager.schedule(new ResetOwner(item), 15000); itemLootShedule = ThreadPool.schedule(new ResetOwner(item), 15000);
item.setItemLootShedule(itemLootShedule); item.setItemLootShedule(itemLootShedule);
} }
} }
@@ -19,7 +19,7 @@ package com.l2jmobius.gameserver.idfactory;
import java.util.BitSet; import java.util.BitSet;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.util.PrimeFinder; import com.l2jmobius.gameserver.util.PrimeFinder;
/** /**
@@ -53,7 +53,7 @@ public class BitSetIDFactory extends IdFactory
synchronized (BitSetIDFactory.class) synchronized (BitSetIDFactory.class)
{ {
ThreadPoolManager.scheduleAtFixedRate(new BitSetCapacityCheck(), 30000, 30000); ThreadPool.scheduleAtFixedRate(new BitSetCapacityCheck(), 30000, 30000);
initialize(); initialize();
} }
LOGGER.info(getClass().getSimpleName() + ": " + _freeIds.size() + " id's available."); LOGGER.info(getClass().getSimpleName() + ": " + _freeIds.size() + " id's available.");
@@ -38,10 +38,10 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.IGameXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.enums.ManorMode; import com.l2jmobius.gameserver.enums.ManorMode;
import com.l2jmobius.gameserver.model.CropProcure; import com.l2jmobius.gameserver.model.CropProcure;
import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Clan;
@@ -106,7 +106,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
// Schedule autosave // Schedule autosave
if (!Config.ALT_MANOR_SAVE_ALL_ACTIONS) if (!Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{ {
ThreadPoolManager.scheduleAtFixedRate(this::storeMe, Config.ALT_MANOR_SAVE_PERIOD_RATE * 60 * 60 * 1000, Config.ALT_MANOR_SAVE_PERIOD_RATE * 60 * 60 * 1000); ThreadPool.scheduleAtFixedRate(this::storeMe, Config.ALT_MANOR_SAVE_PERIOD_RATE * 60 * 60 * 1000, Config.ALT_MANOR_SAVE_PERIOD_RATE * 60 * 60 * 1000);
} }
} }
else else
@@ -277,7 +277,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
} }
} }
// Schedule mode change // Schedule mode change
ThreadPoolManager.schedule(this::changeMode, (_nextModeChange.getTimeInMillis() - System.currentTimeMillis())); ThreadPool.schedule(this::changeMode, (_nextModeChange.getTimeInMillis() - System.currentTimeMillis()));
} }
public final void changeMode() public final void changeMode()
@@ -33,9 +33,9 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.model.clan.entry.PledgeApplicantInfo; import com.l2jmobius.gameserver.model.clan.entry.PledgeApplicantInfo;
import com.l2jmobius.gameserver.model.clan.entry.PledgeRecruitInfo; import com.l2jmobius.gameserver.model.clan.entry.PledgeRecruitInfo;
import com.l2jmobius.gameserver.model.clan.entry.PledgeWaitingInfo; import com.l2jmobius.gameserver.model.clan.entry.PledgeWaitingInfo;
@@ -390,7 +390,7 @@ public class ClanEntryManager
private static void lockPlayer(int playerId) private static void lockPlayer(int playerId)
{ {
_playerLocked.put(playerId, ThreadPoolManager.schedule(() -> _playerLocked.put(playerId, ThreadPool.schedule(() ->
{ {
_playerLocked.remove(playerId); _playerLocked.remove(playerId);
}, LOCK_TIME)); }, LOCK_TIME));
@@ -398,7 +398,7 @@ public class ClanEntryManager
private static void lockClan(int clanId) private static void lockClan(int clanId)
{ {
_clanLocked.put(clanId, ThreadPoolManager.schedule(() -> _clanLocked.put(clanId, ThreadPool.schedule(() ->
{ {
_clanLocked.remove(clanId); _clanLocked.remove(clanId);
}, LOCK_TIME)); }, LOCK_TIME));
@@ -34,8 +34,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.enums.ItemLocation; import com.l2jmobius.gameserver.enums.ItemLocation;
import com.l2jmobius.gameserver.enums.MailType; import com.l2jmobius.gameserver.enums.MailType;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -114,7 +114,7 @@ public final class CommissionManager
} }
else else
{ {
commissionItem.setSaleEndTask(ThreadPoolManager.schedule(() -> expireSale(commissionItem), Duration.between(Instant.now(), commissionItem.getEndTime()).toMillis())); commissionItem.setSaleEndTask(ThreadPool.schedule(() -> expireSale(commissionItem), Duration.between(Instant.now(), commissionItem.getEndTime()).toMillis()));
} }
} }
} }
@@ -259,7 +259,7 @@ public final class CommissionManager
if (rs.next()) if (rs.next())
{ {
final CommissionItem commissionItem = new CommissionItem(rs.getLong(1), itemInstance, pricePerUnit, startTime, durationInDays); final CommissionItem commissionItem = new CommissionItem(rs.getLong(1), itemInstance, pricePerUnit, startTime, durationInDays);
final ScheduledFuture<?> saleEndTask = ThreadPoolManager.schedule(() -> expireSale(commissionItem), Duration.between(Instant.now(), commissionItem.getEndTime()).toMillis()); final ScheduledFuture<?> saleEndTask = ThreadPool.schedule(() -> expireSale(commissionItem), Duration.between(Instant.now(), commissionItem.getEndTime()).toMillis());
commissionItem.setSaleEndTask(saleEndTask); commissionItem.setSaleEndTask(saleEndTask);
_commissionItems.put(commissionItem.getCommissionId(), commissionItem); _commissionItems.put(commissionItem.getCommissionId(), commissionItem);
player.getLastCommissionInfos().put(itemInstance.getId(), new ExResponseCommissionInfo(itemInstance.getId(), pricePerUnit, itemCount, (byte) ((durationInDays - 1) / 2))); player.getLastCommissionInfos().put(itemInstance.getId(), new ExResponseCommissionInfo(itemInstance.getId(), pricePerUnit, itemCount, (byte) ((durationInDays - 1) / 2)));
@@ -29,9 +29,9 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.NpcData; import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.data.xml.impl.SpawnsData; import com.l2jmobius.gameserver.data.xml.impl.SpawnsData;
import com.l2jmobius.gameserver.datatables.SpawnTable; import com.l2jmobius.gameserver.datatables.SpawnTable;
@@ -209,7 +209,7 @@ public class DBSpawnManager
{ {
LOGGER.info(getClass().getSimpleName() + ": Updated " + npc.getName() + " respawn time to " + Util.formatDate(new Date(respawnTime), "dd.MM.yyyy HH:mm")); LOGGER.info(getClass().getSimpleName() + ": Updated " + npc.getName() + " respawn time to " + Util.formatDate(new Date(respawnTime), "dd.MM.yyyy HH:mm"));
_schedules.put(npc.getId(), ThreadPoolManager.schedule(() -> scheduleSpawn(npc.getId()), respawnDelay)); _schedules.put(npc.getId(), ThreadPool.schedule(() -> scheduleSpawn(npc.getId()), respawnDelay));
updateDb(); updateDb();
} }
} }
@@ -270,7 +270,7 @@ public class DBSpawnManager
else else
{ {
final long spawnTime = respawnTime - System.currentTimeMillis(); final long spawnTime = respawnTime - System.currentTimeMillis();
_schedules.put(npcId, ThreadPoolManager.schedule(() -> scheduleSpawn(npcId), spawnTime)); _schedules.put(npcId, ThreadPool.schedule(() -> scheduleSpawn(npcId), spawnTime));
} }
_spawns.put(npcId, spawn); _spawns.put(npcId, spawn);
@@ -24,9 +24,9 @@ import java.util.logging.Logger;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.IGameXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.FakePlayerData; import com.l2jmobius.gameserver.data.xml.impl.FakePlayerData;
import com.l2jmobius.gameserver.datatables.SpawnTable; import com.l2jmobius.gameserver.datatables.SpawnTable;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
@@ -80,12 +80,12 @@ public final class FakePlayerChatManager implements IGameXmlReader
public void manageChat(L2PcInstance player, String fpcName, String message) public void manageChat(L2PcInstance player, String fpcName, String message)
{ {
ThreadPoolManager.schedule(() -> manageResponce(player, fpcName, message), Rnd.get(MIN_DELAY, MAX_DELAY)); ThreadPool.schedule(() -> manageResponce(player, fpcName, message), Rnd.get(MIN_DELAY, MAX_DELAY));
} }
public void manageChat(L2PcInstance player, String fpcName, String message, int minDelay, int maxDelay) public void manageChat(L2PcInstance player, String fpcName, String message, int minDelay, int maxDelay)
{ {
ThreadPoolManager.schedule(() -> manageResponce(player, fpcName, message), Rnd.get(minDelay, maxDelay)); ThreadPool.schedule(() -> manageResponce(player, fpcName, message), Rnd.get(minDelay, maxDelay));
} }
private void manageResponce(L2PcInstance player, String fpcName, String message) private void manageResponce(L2PcInstance player, String fpcName, String message)
@@ -20,7 +20,7 @@ import java.util.Calendar;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.instancemanager.tasks.UpdateSoDStateTask; import com.l2jmobius.gameserver.instancemanager.tasks.UpdateSoDStateTask;
import com.l2jmobius.gameserver.model.quest.Quest; import com.l2jmobius.gameserver.model.quest.Quest;
@@ -112,7 +112,7 @@ public final class GraciaSeedsManager
} }
else else
{ {
ThreadPoolManager.schedule(new UpdateSoDStateTask(), Config.SOD_STAGE_2_LENGTH - timePast); ThreadPool.schedule(new UpdateSoDStateTask(), Config.SOD_STAGE_2_LENGTH - timePast);
} }
break; break;
} }
@@ -29,8 +29,8 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.NpcData; import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.instancemanager.tasks.GrandBossManagerStoreTask; import com.l2jmobius.gameserver.instancemanager.tasks.GrandBossManagerStoreTask;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
@@ -104,7 +104,7 @@ public final class GrandBossManager implements IStorable
{ {
_log.log(Level.WARNING, getClass().getSimpleName() + ": Error while initializing GrandBossManager: " + e.getMessage(), e); _log.log(Level.WARNING, getClass().getSimpleName() + ": Error while initializing GrandBossManager: " + e.getMessage(), e);
} }
ThreadPoolManager.scheduleAtFixedRate(new GrandBossManagerStoreTask(), 5 * 60 * 1000, 5 * 60 * 1000); ThreadPool.scheduleAtFixedRate(new GrandBossManagerStoreTask(), 5 * 60 * 1000, 5 * 60 * 1000);
} }
public int getBossStatus(int bossId) public int getBossStatus(int bossId)
@@ -23,7 +23,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.enums.Team;
import com.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask; import com.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask;
import com.l2jmobius.gameserver.model.ArenaParticipantsHolder; import com.l2jmobius.gameserver.model.ArenaParticipantsHolder;
@@ -86,7 +86,7 @@ public final class HandysBlockCheckerManager
{ {
holder.checkAndShuffle(); holder.checkAndShuffle();
} }
ThreadPoolManager.execute(holder.getEvent().new StartEvent()); ThreadPool.execute(holder.getEvent().new StartEvent());
} }
else else
{ {
@@ -364,7 +364,7 @@ public final class HandysBlockCheckerManager
private void schedulePenaltyRemoval(int objId) private void schedulePenaltyRemoval(int objId)
{ {
ThreadPoolManager.schedule(new PenaltyRemoveTask(objId), 10000); ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000);
} }
/** /**
@@ -27,9 +27,9 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ItemsAutoDestroy; import com.l2jmobius.gameserver.ItemsAutoDestroy;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
@@ -47,7 +47,7 @@ public final class ItemsOnGroundManager implements Runnable
{ {
if (Config.SAVE_DROPPED_ITEM_INTERVAL > 0) if (Config.SAVE_DROPPED_ITEM_INTERVAL > 0)
{ {
ThreadPoolManager.scheduleAtFixedRate(this, Config.SAVE_DROPPED_ITEM_INTERVAL, Config.SAVE_DROPPED_ITEM_INTERVAL); ThreadPool.scheduleAtFixedRate(this, Config.SAVE_DROPPED_ITEM_INTERVAL, Config.SAVE_DROPPED_ITEM_INTERVAL);
} }
load(); load();
} }
@@ -29,8 +29,8 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.enums.MailType; import com.l2jmobius.gameserver.enums.MailType;
import com.l2jmobius.gameserver.idfactory.IdFactory; import com.l2jmobius.gameserver.idfactory.IdFactory;
import com.l2jmobius.gameserver.instancemanager.tasks.MessageDeletionTask; import com.l2jmobius.gameserver.instancemanager.tasks.MessageDeletionTask;
@@ -74,11 +74,11 @@ public final class MailManager
if (expiration < System.currentTimeMillis()) if (expiration < System.currentTimeMillis())
{ {
ThreadPoolManager.schedule(new MessageDeletionTask(msgId), 10000); ThreadPool.schedule(new MessageDeletionTask(msgId), 10000);
} }
else else
{ {
ThreadPoolManager.schedule(new MessageDeletionTask(msgId), expiration - System.currentTimeMillis()); ThreadPool.schedule(new MessageDeletionTask(msgId), expiration - System.currentTimeMillis());
} }
} }
} }
@@ -209,7 +209,7 @@ public final class MailManager
receiver.sendPacket(new ExUnReadMailCount(receiver)); receiver.sendPacket(new ExUnReadMailCount(receiver));
} }
ThreadPoolManager.schedule(new MessageDeletionTask(msg.getId()), msg.getExpiration() - System.currentTimeMillis()); ThreadPool.schedule(new MessageDeletionTask(msg.getId()), msg.getExpiration() - System.currentTimeMillis());
} }
public final void markAsReadInDb(int msgId) public final void markAsReadInDb(int msgId)
@@ -26,8 +26,8 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Consumer; import java.util.function.Consumer;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.events.Containers; import com.l2jmobius.gameserver.model.events.Containers;
@@ -109,7 +109,7 @@ public class PremiumManager
*/ */
private void startExpireTask(L2PcInstance player, long delay) private void startExpireTask(L2PcInstance player, long delay)
{ {
ScheduledFuture<?> task = ThreadPoolManager.schedule(new PremiumExpireTask(player), delay); ScheduledFuture<?> task = ThreadPool.schedule(new PremiumExpireTask(player), delay);
expiretasks.put(player.getAccountName(), task); expiretasks.put(player.getAccountName(), task);
} }
@@ -21,8 +21,8 @@ import java.util.Calendar;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.Shutdown; import com.l2jmobius.gameserver.Shutdown;
import com.l2jmobius.gameserver.ThreadPoolManager;
/** /**
* @author Gigi * @author Gigi
@@ -71,7 +71,7 @@ public class ServerRestartManager
if (lastRestart != null) if (lastRestart != null)
{ {
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime()); nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
ThreadPoolManager.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000)); ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
_log.info("Scheduled server restart at " + lastRestart.getTime() + "."); _log.info("Scheduled server restart at " + lastRestart.getTime() + ".");
} }
} }
@@ -27,8 +27,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.IGameXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.data.xml.impl.NpcData; import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
@@ -299,13 +299,13 @@ public final class WalkingManager implements IGameXmlReader
npc.setWalking(); npc.setWalking();
} }
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, node); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, node);
walk.setWalkCheckTask(ThreadPoolManager.scheduleAtFixedRate(new StartMovingTask(npc, routeName), 60000, 60000)); // start walk check task, for resuming walk after fight walk.setWalkCheckTask(ThreadPool.scheduleAtFixedRate(new StartMovingTask(npc, routeName), 60000, 60000)); // start walk check task, for resuming walk after fight
_activeRoutes.put(npc.getObjectId(), walk); // register route _activeRoutes.put(npc.getObjectId(), walk); // register route
} }
else else
{ {
ThreadPoolManager.schedule(new StartMovingTask(npc, routeName), 60000); ThreadPool.schedule(new StartMovingTask(npc, routeName), 60000);
} }
} }
else else
@@ -446,7 +446,7 @@ public final class WalkingManager implements IGameXmlReader
npc.broadcastSay(ChatType.NPC_GENERAL, node.getChatText()); npc.broadcastSay(ChatType.NPC_GENERAL, node.getChatText());
} }
ThreadPoolManager.schedule(new ArrivedTask(npc, walk), 100 + (node.getDelay() * 1000L)); ThreadPool.schedule(new ArrivedTask(npc, walk), 100 + (node.getDelay() * 1000L));
} }
} }
} }
@@ -21,7 +21,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.EventDispatcher;
@@ -56,7 +56,7 @@ public final class ClanWar
_startTime = System.currentTimeMillis(); _startTime = System.currentTimeMillis();
_state = ClanWarState.BLOOD_DECLARATION; _state = ClanWarState.BLOOD_DECLARATION;
_cancelTask = ThreadPoolManager.schedule(() -> _cancelTask = ThreadPool.schedule(() ->
{ {
clanWarTimeout(); clanWarTimeout();
}, (_startTime + TIME_TO_CANCEL_NON_MUTUAL_CLAN_WAR) - System.currentTimeMillis()); }, (_startTime + TIME_TO_CANCEL_NON_MUTUAL_CLAN_WAR) - System.currentTimeMillis());
@@ -88,7 +88,7 @@ public final class ClanWar
if ((_startTime + TIME_TO_CANCEL_NON_MUTUAL_CLAN_WAR) > System.currentTimeMillis()) if ((_startTime + TIME_TO_CANCEL_NON_MUTUAL_CLAN_WAR) > System.currentTimeMillis())
{ {
_cancelTask = ThreadPoolManager.schedule(() -> _cancelTask = ThreadPool.schedule(() ->
{ {
clanWarTimeout(); clanWarTimeout();
}, (_startTime + TIME_TO_CANCEL_NON_MUTUAL_CLAN_WAR) - System.currentTimeMillis()); }, (_startTime + TIME_TO_CANCEL_NON_MUTUAL_CLAN_WAR) - System.currentTimeMillis());
@@ -104,7 +104,7 @@ public final class ClanWar
} }
else else
{ {
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
ClanTable.getInstance().deleteclanswars(_attackerClanId, _attackedClanId); ClanTable.getInstance().deleteclanswars(_attackerClanId, _attackedClanId);
}, endTimePeriod); }, endTimePeriod);
@@ -200,7 +200,7 @@ public final class ClanWar
_winnerClanId = winnerClan.getId(); _winnerClanId = winnerClan.getId();
_endTime = System.currentTimeMillis(); _endTime = System.currentTimeMillis();
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
ClanTable.getInstance().deleteclanswars(cancelor.getId(), winnerClan.getId()); ClanTable.getInstance().deleteclanswars(cancelor.getId(), winnerClan.getId());
}, (_endTime + TIME_TO_DELETION_AFTER_DEFEAT) - System.currentTimeMillis()); }, (_endTime + TIME_TO_DELETION_AFTER_DEFEAT) - System.currentTimeMillis());
@@ -225,7 +225,7 @@ public final class ClanWar
_state = ClanWarState.TIE; _state = ClanWarState.TIE;
_endTime = System.currentTimeMillis(); _endTime = System.currentTimeMillis();
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
ClanTable.getInstance().deleteclanswars(attackerClan.getId(), attackedClan.getId()); ClanTable.getInstance().deleteclanswars(attackerClan.getId(), attackedClan.getId());
}, (_endTime + TIME_TO_DELETION_AFTER_CANCELLATION) - System.currentTimeMillis()); }, (_endTime + TIME_TO_DELETION_AFTER_CANCELLATION) - System.currentTimeMillis());
@@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.function.Predicate; import java.util.function.Predicate;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.EventDispatcher;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureSee; import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureSee;
@@ -63,7 +63,7 @@ public class CreatureContainer
{ {
if ((_task == null) || _task.isDone()) if ((_task == null) || _task.isDone())
{ {
_task = ThreadPoolManager.scheduleAtFixedRate(this::update, 1000L, 1000L); _task = ThreadPool.scheduleAtFixedRate(this::update, 1000L, 1000L);
} }
} }
@@ -24,9 +24,9 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import com.l2jmobius.gameserver.model.L2Party.MessageType; import com.l2jmobius.gameserver.model.L2Party.MessageType;
@@ -350,7 +350,7 @@ public class CursedWeapon implements INamable
{ {
_player.stopTransformation(true); _player.stopTransformation(true);
ThreadPoolManager.schedule(() -> _player.transform(transformationId, true), 500); ThreadPool.schedule(() -> _player.transform(transformationId, true), 500);
} }
else else
{ {
@@ -374,7 +374,7 @@ public class CursedWeapon implements INamable
} }
else else
{ {
_removeTask = ThreadPoolManager.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000L, _durationLost * 12000L); _removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000L, _durationLost * 12000L);
} }
} }
@@ -388,7 +388,7 @@ public class CursedWeapon implements INamable
// Start the Life Task // Start the Life Task
_endTime = System.currentTimeMillis() + (_duration * 60000L); _endTime = System.currentTimeMillis() + (_duration * 60000L);
_removeTask = ThreadPoolManager.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000L, _durationLost * 12000L); _removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000L, _durationLost * 12000L);
return true; return true;
} }
@@ -18,7 +18,7 @@ package com.l2jmobius.gameserver.model;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
@@ -104,6 +104,6 @@ public class DropProtection implements Runnable
throw new NullPointerException("Trying to protect dropped item to null owner"); throw new NullPointerException("Trying to protect dropped item to null owner");
} }
_task = ThreadPoolManager.schedule(this, PROTECTED_MILLIS_TIME); _task = ThreadPool.schedule(this, PROTECTED_MILLIS_TIME);
} }
} }
@@ -21,8 +21,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.FishingData; import com.l2jmobius.gameserver.data.xml.impl.FishingData;
import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.enums.ShotType;
import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.geoengine.GeoEngine;
@@ -220,10 +220,10 @@ public class Fishing
_player.rechargeShots(false, false, true); _player.rechargeShots(false, false, true);
} }
_reelInTask = ThreadPoolManager.schedule(() -> _reelInTask = ThreadPool.schedule(() ->
{ {
_player.getFishing().reelInWithReward(); _player.getFishing().reelInWithReward();
_startFishingTask = ThreadPoolManager.schedule(() -> _player.getFishing().castLine(), Rnd.get(baitData.getWaitMin(), baitData.getWaitMax())); _startFishingTask = ThreadPool.schedule(() -> _player.getFishing().castLine(), Rnd.get(baitData.getWaitMin(), baitData.getWaitMax()));
}, Rnd.get(baitData.getTimeMin(), baitData.getTimeMax())); }, Rnd.get(baitData.getTimeMin(), baitData.getTimeMax()));
_player.stopMove(null); _player.stopMove(null);
_player.broadcastPacket(new ExFishingStart(_player, -1, baitData.getLevel(), _baitLocation)); _player.broadcastPacket(new ExFishingStart(_player, -1, baitData.getLevel(), _baitLocation));
@@ -33,8 +33,8 @@ import java.util.logging.Logger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.communitybbs.BB.Forum; import com.l2jmobius.gameserver.communitybbs.BB.Forum;
import com.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager; import com.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager;
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
@@ -3177,7 +3177,7 @@ public class L2Clan implements IIdentifiable, INamable
_vars = new ClanVariables(getId()); _vars = new ClanVariables(getId());
if (Config.CLAN_VARIABLES_STORE_INTERVAL > 0) if (Config.CLAN_VARIABLES_STORE_INTERVAL > 0)
{ {
ThreadPoolManager.scheduleAtFixedRate(this::storeVariables, Config.CLAN_VARIABLES_STORE_INTERVAL, Config.CLAN_VARIABLES_STORE_INTERVAL); ThreadPool.scheduleAtFixedRate(this::storeVariables, Config.CLAN_VARIABLES_STORE_INTERVAL, Config.CLAN_VARIABLES_STORE_INTERVAL);
} }
} }
} }
@@ -30,9 +30,9 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.PartyDistributionType; import com.l2jmobius.gameserver.enums.PartyDistributionType;
import com.l2jmobius.gameserver.instancemanager.DuelManager; import com.l2jmobius.gameserver.instancemanager.DuelManager;
@@ -380,7 +380,7 @@ public class L2Party extends AbstractPlayerGroup
if (_positionBroadcastTask == null) if (_positionBroadcastTask == null)
{ {
_positionBroadcastTask = ThreadPoolManager.scheduleAtFixedRate(() -> _positionBroadcastTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
if (_positionPacket == null) if (_positionPacket == null)
{ {
@@ -1089,7 +1089,7 @@ public class L2Party extends AbstractPlayerGroup
} }
_changeRequestDistributionType = partyDistributionType; _changeRequestDistributionType = partyDistributionType;
_changeDistributionTypeAnswers = new HashSet<>(); _changeDistributionTypeAnswers = new HashSet<>();
_changeDistributionTypeRequestTask = ThreadPoolManager.schedule(() -> finishLootRequest(false), PARTY_DISTRIBUTION_TYPE_REQUEST_TIMEOUT.toMillis()); _changeDistributionTypeRequestTask = ThreadPool.schedule(() -> finishLootRequest(false), PARTY_DISTRIBUTION_TYPE_REQUEST_TIMEOUT.toMillis());
broadcastToPartyMembers(getLeader(), new ExAskModifyPartyLooting(getLeader().getName(), partyDistributionType)); broadcastToPartyMembers(getLeader(), new ExAskModifyPartyLooting(getLeader().getName(), partyDistributionType));
@@ -16,7 +16,7 @@
*/ */
package com.l2jmobius.gameserver.model; package com.l2jmobius.gameserver.model;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
@@ -123,7 +123,7 @@ public class L2Request
{ {
_isRequestor = isRequestor; _isRequestor = isRequestor;
_isAnswerer = !isRequestor; _isAnswerer = !isRequestor;
ThreadPoolManager.schedule(() -> clear(), REQUEST_TIMEOUT * 1000); ThreadPool.schedule(() -> clear(), REQUEST_TIMEOUT * 1000);
} }
/** /**
@@ -24,8 +24,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.NpcData; import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -396,7 +396,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
_scheduledCount++; _scheduledCount++;
// Create a new SpawnTask to launch after the respawn Delay // Create a new SpawnTask to launch after the respawn Delay
ThreadPoolManager.schedule(new SpawnTask(), hasRespawnRandom() ? Rnd.get(_respawnMinDelay, _respawnMaxDelay) : _respawnMinDelay); ThreadPool.schedule(new SpawnTask(), hasRespawnRandom() ? Rnd.get(_respawnMinDelay, _respawnMaxDelay) : _respawnMinDelay);
} }
} }
@@ -24,7 +24,7 @@ import java.util.function.Predicate;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; 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.datatables.SpawnTable;
import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -186,7 +186,7 @@ public final class L2WorldRegion
} }
// then, set a timer to activate the neighbors // then, set a timer to activate the neighbors
_neighborsTask = ThreadPoolManager.schedule(new NeighborsTask(true), 1000 * Config.GRID_NEIGHBOR_TURNON_TIME); _neighborsTask = ThreadPool.schedule(new NeighborsTask(true), 1000 * Config.GRID_NEIGHBOR_TURNON_TIME);
} }
} }
@@ -206,7 +206,7 @@ public final class L2WorldRegion
// start a timer to "suggest" a deactivate to self and neighbors. // start a timer to "suggest" a deactivate to self and neighbors.
// suggest means: first check if a neighbor has L2PcInstances in it. If not, deactivate. // suggest means: first check if a neighbor has L2PcInstances in it. If not, deactivate.
_neighborsTask = ThreadPoolManager.schedule(new NeighborsTask(false), 1000 * Config.GRID_NEIGHBOR_TURNOFF_TIME); _neighborsTask = ThreadPool.schedule(new NeighborsTask(false), 1000 * Config.GRID_NEIGHBOR_TURNOFF_TIME);
} }
} }
@@ -20,7 +20,7 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
@@ -41,7 +41,7 @@ public class MpRewardTask
_creature = creature; _creature = creature;
_count = new AtomicInteger(template.getMpRewardTicks()); _count = new AtomicInteger(template.getMpRewardTicks());
_value = calculateBaseValue(npc, creature); _value = calculateBaseValue(npc, creature);
_task = ThreadPoolManager.scheduleAtFixedRate(this::run, Config.EFFECT_TICK_RATIO, Config.EFFECT_TICK_RATIO); _task = ThreadPool.scheduleAtFixedRate(this::run, Config.EFFECT_TICK_RATIO, Config.EFFECT_TICK_RATIO);
} }
/** /**
@@ -32,8 +32,8 @@ import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.ai.CtrlEvent;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.ai.L2AttackableAI; import com.l2jmobius.gameserver.ai.L2AttackableAI;
@@ -235,7 +235,7 @@ public class L2Attackable extends L2Npc
{ {
_commandChannelTimer = new CommandChannelTimer(this); _commandChannelTimer = new CommandChannelTimer(this);
_commandChannelLastAttack = System.currentTimeMillis(); _commandChannelLastAttack = System.currentTimeMillis();
ThreadPoolManager.schedule(_commandChannelTimer, 10000); // check for last attack ThreadPool.schedule(_commandChannelTimer, 10000); // check for last attack
_firstCommandChannelAttacked.broadcastPacket(new CreatureSay(0, ChatType.PARTYROOM_ALL, "", "You have looting rights!")); // TODO: retail msg _firstCommandChannelAttacked.broadcastPacket(new CreatureSay(0, ChatType.PARTYROOM_ALL, "", "You have looting rights!")); // TODO: retail msg
} }
} }
@@ -40,10 +40,10 @@ import java.util.logging.Logger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.EmptyQueue; import com.l2jmobius.commons.util.EmptyQueue;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.ai.CtrlEvent;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.ai.L2AttackableAI; import com.l2jmobius.gameserver.ai.L2AttackableAI;
@@ -1010,7 +1010,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{ {
if (isPlayer()) if (isPlayer())
{ {
ThreadPoolManager.schedule(new NotifyAITask(this, CtrlEvent.EVT_READY_TO_ACT), 1000); ThreadPool.schedule(new NotifyAITask(this, CtrlEvent.EVT_READY_TO_ACT), 1000);
sendPacket(ActionFailed.STATIC_PACKET); sendPacket(ActionFailed.STATIC_PACKET);
} }
return; return;
@@ -1049,7 +1049,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
if (getCurrentMp() < mpConsume) if (getCurrentMp() < mpConsume)
{ {
// If L2PcInstance doesn't have enough MP, stop the attack // If L2PcInstance doesn't have enough MP, stop the attack
ThreadPoolManager.schedule(new NotifyAITask(this, CtrlEvent.EVT_READY_TO_ACT), 1000); ThreadPool.schedule(new NotifyAITask(this, CtrlEvent.EVT_READY_TO_ACT), 1000);
sendPacket(SystemMessageId.NOT_ENOUGH_MP); sendPacket(SystemMessageId.NOT_ENOUGH_MP);
sendPacket(ActionFailed.STATIC_PACKET); sendPacket(ActionFailed.STATIC_PACKET);
return; return;
@@ -1119,14 +1119,14 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
// Calculate and set the disable delay of the bow in function of the Attack Speed // Calculate and set the disable delay of the bow in function of the Attack Speed
_disableRangedAttackEndTime = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(reuse); _disableRangedAttackEndTime = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(reuse);
_hitTask = ThreadPoolManager.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit); _hitTask = ThreadPool.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit);
break; break;
} }
case FIST: case FIST:
{ {
if (!isPlayer()) if (!isPlayer())
{ {
_hitTask = ThreadPoolManager.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit); _hitTask = ThreadPool.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit);
break; break;
} }
} }
@@ -1136,12 +1136,12 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
case DUALDAGGER: case DUALDAGGER:
{ {
final int timeToHit2 = Formulas.calculateTimeToHit(timeAtk, weaponType, isTwoHanded, true) - timeToHit; final int timeToHit2 = Formulas.calculateTimeToHit(timeAtk, weaponType, isTwoHanded, true) - timeToHit;
_hitTask = ThreadPoolManager.schedule(() -> onFirstHitTimeForDual(weaponItem, attack, timeToHit, timeAtk, timeToHit2), timeToHit); _hitTask = ThreadPool.schedule(() -> onFirstHitTimeForDual(weaponItem, attack, timeToHit, timeAtk, timeToHit2), timeToHit);
break; break;
} }
default: default:
{ {
_hitTask = ThreadPoolManager.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit); _hitTask = ThreadPool.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit);
break; break;
} }
} }
@@ -2986,7 +2986,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
if (distFraction > 1) if (distFraction > 1)
{ {
ThreadPoolManager.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED)); ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
return true; return true;
} }
@@ -3404,7 +3404,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
// Create a task to notify the AI that L2Character arrives at a check point of the movement // Create a task to notify the AI that L2Character arrives at a check point of the movement
if ((ticksToMove * GameTimeController.MILLIS_IN_TICK) > 3000) if ((ticksToMove * GameTimeController.MILLIS_IN_TICK) > 3000)
{ {
ThreadPoolManager.schedule(new NotifyAITask(this, CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000); ThreadPool.schedule(new NotifyAITask(this, CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000);
} }
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive to destination by GameTimeController // the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive to destination by GameTimeController
} }
@@ -3482,7 +3482,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
// Create a task to notify the AI that L2Character arrives at a check point of the movement // Create a task to notify the AI that L2Character arrives at a check point of the movement
if ((ticksToMove * GameTimeController.MILLIS_IN_TICK) > 3000) if ((ticksToMove * GameTimeController.MILLIS_IN_TICK) > 3000)
{ {
ThreadPoolManager.schedule(new NotifyAITask(this, CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000); ThreadPool.schedule(new NotifyAITask(this, CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000);
} }
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive // the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
@@ -3635,7 +3635,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
} }
} }
_hitTask = ThreadPoolManager.schedule(() -> onAttackFinish(attack), attackTime - hitTime); _hitTask = ThreadPool.schedule(() -> onAttackFinish(attack), attackTime - hitTime);
} }
public void onFirstHitTimeForDual(L2Weapon weapon, Attack attack, int hitTime, int attackTime, int delayForSecondAttack) public void onFirstHitTimeForDual(L2Weapon weapon, Attack attack, int hitTime, int attackTime, int delayForSecondAttack)
@@ -3646,7 +3646,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return; return;
} }
_hitTask = ThreadPoolManager.schedule(() -> onSecondHitTimeForDual(weapon, attack, hitTime, delayForSecondAttack, attackTime), delayForSecondAttack); _hitTask = ThreadPool.schedule(() -> onSecondHitTimeForDual(weapon, attack, hitTime, delayForSecondAttack, attackTime), delayForSecondAttack);
// First dual attack is the first hit only. // First dual attack is the first hit only.
final Hit hit = attack.getHits().get(0); final Hit hit = attack.getHits().get(0);
@@ -3696,7 +3696,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
} }
} }
_hitTask = ThreadPoolManager.schedule(() -> onAttackFinish(attack), attackTime - (hitTime1 + hitTime2)); _hitTask = ThreadPool.schedule(() -> onAttackFinish(attack), attackTime - (hitTime1 + hitTime2));
} }
public void onHitTarget(L2Character target, L2Weapon weapon, Hit hit) public void onHitTarget(L2Character target, L2Weapon weapon, Hit hit)
@@ -20,9 +20,9 @@ import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ItemsAutoDestroy; import com.l2jmobius.gameserver.ItemsAutoDestroy;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.cache.HtmCache; import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData;
import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.datatables.ItemTable;
@@ -1316,7 +1316,7 @@ public class L2Npc extends L2Character
public void scheduleDespawn(long delay) public void scheduleDespawn(long delay)
{ {
ThreadPoolManager.schedule(() -> ThreadPool.schedule(() ->
{ {
if (!isDecayed()) if (!isDecayed())
{ {
@@ -21,8 +21,8 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level; import java.util.logging.Level;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.instancemanager.MapRegionManager; import com.l2jmobius.gameserver.instancemanager.MapRegionManager;
@@ -87,7 +87,7 @@ public abstract class L2Vehicle extends L2Character
{ {
if (_engine != null) if (_engine != null)
{ {
ThreadPoolManager.schedule(_engine, delay); ThreadPool.schedule(_engine, delay);
} }
} }
@@ -18,7 +18,7 @@ package com.l2jmobius.gameserver.model.actor.instance;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.idfactory.IdFactory; import com.l2jmobius.gameserver.idfactory.IdFactory;
import com.l2jmobius.gameserver.model.actor.stat.ControllableAirShipStat; import com.l2jmobius.gameserver.model.actor.stat.ControllableAirShipStat;
@@ -253,8 +253,8 @@ public class L2ControllableAirShipInstance extends L2AirShipInstance
public void onSpawn() public void onSpawn()
{ {
super.onSpawn(); super.onSpawn();
_checkTask = ThreadPoolManager.scheduleAtFixedRate(new CheckTask(), 60000, 10000); _checkTask = ThreadPool.scheduleAtFixedRate(new CheckTask(), 60000, 10000);
_consumeFuelTask = ThreadPoolManager.scheduleAtFixedRate(new ConsumeFuelTask(), 60000, 60000); _consumeFuelTask = ThreadPool.scheduleAtFixedRate(new ConsumeFuelTask(), 60000, 60000);
} }
@Override @Override
@@ -326,7 +326,7 @@ public class L2ControllableAirShipInstance extends L2AirShipInstance
if (isSpawned() && isEmpty() && !isInDock()) if (isSpawned() && isEmpty() && !isInDock())
{ {
// deleteMe() can't be called from CheckTask because task should not cancel itself // deleteMe() can't be called from CheckTask because task should not cancel itself
ThreadPoolManager.execute(new DecayTask()); ThreadPool.execute(new DecayTask());
} }
} }
} }
@@ -19,7 +19,7 @@ package com.l2jmobius.gameserver.model.actor.instance;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.logging.Level; import java.util.logging.Level;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager;
@@ -53,8 +53,8 @@ public class L2DecoyInstance extends L2Character
_totalLifeTime = totalLifeTime; _totalLifeTime = totalLifeTime;
_timeRemaining = _totalLifeTime; _timeRemaining = _totalLifeTime;
final int skilllevel = getTemplate().getDisplayId() - 13070; final int skilllevel = getTemplate().getDisplayId() - 13070;
_DecoyLifeTask = ThreadPoolManager.scheduleAtFixedRate(new DecoyLifetime(getOwner(), this), 1000, 1000); _DecoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(getOwner(), this), 1000, 1000);
_HateSpam = ThreadPoolManager.scheduleAtFixedRate(new HateSpam(this, SkillData.getInstance().getSkill(5272, skilllevel)), 2000, 5000); _HateSpam = ThreadPool.scheduleAtFixedRate(new HateSpam(this, SkillData.getInstance().getSkill(5272, skilllevel)), 2000, 5000);
} }
@Override @Override
@@ -20,8 +20,8 @@ import java.util.Collection;
import java.util.Set; import java.util.Set;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.L2CharacterAI; import com.l2jmobius.gameserver.ai.L2CharacterAI;
import com.l2jmobius.gameserver.ai.L2DoorAI; import com.l2jmobius.gameserver.ai.L2DoorAI;
import com.l2jmobius.gameserver.data.xml.impl.DoorData; import com.l2jmobius.gameserver.data.xml.impl.DoorData;
@@ -107,7 +107,7 @@ public final class L2DoorInstance extends L2Character
{ {
delay += Rnd.get(getTemplate().getRandomTime()); delay += Rnd.get(getTemplate().getRandomTime());
} }
ThreadPoolManager.schedule(new TimerOpen(), delay * 1000); ThreadPool.schedule(new TimerOpen(), delay * 1000);
} }
@Override @Override
@@ -641,7 +641,7 @@ public final class L2DoorInstance extends L2Character
_autoCloseTask = null; _autoCloseTask = null;
oldTask.cancel(false); oldTask.cancel(false);
} }
_autoCloseTask = ThreadPoolManager.schedule(new AutoClose(), getTemplate().getCloseTime() * 1000); _autoCloseTask = ThreadPool.schedule(new AutoClose(), getTemplate().getCloseTime() * 1000);
} }
class AutoClose implements Runnable class AutoClose implements Runnable
@@ -676,7 +676,7 @@ public final class L2DoorInstance extends L2Character
{ {
delay += Rnd.get(getTemplate().getRandomTime()); delay += Rnd.get(getTemplate().getRandomTime());
} }
ThreadPoolManager.schedule(this, delay * 1000); ThreadPool.schedule(this, delay * 1000);
} }
} }
@@ -18,7 +18,7 @@ package com.l2jmobius.gameserver.model.actor.instance;
import java.util.List; import java.util.List;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.InstanceType;
@@ -146,7 +146,7 @@ public class L2FortCommanderInstance extends L2DefenderInstance
{ {
broadcastSay(ChatType.NPC_SHOUT, npcString, npcString.getParamCount() == 1 ? attacker.getName() : null); broadcastSay(ChatType.NPC_SHOUT, npcString, npcString.getParamCount() == 1 ? attacker.getName() : null);
setCanTalk(false); setCanTalk(false);
ThreadPoolManager.schedule(new ScheduleTalkTask(), 10000); ThreadPool.schedule(new ScheduleTalkTask(), 10000);
} }
} }
} }
@@ -45,13 +45,13 @@ import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.ItemsAutoDestroy; import com.l2jmobius.gameserver.ItemsAutoDestroy;
import com.l2jmobius.gameserver.LoginServerThread; import com.l2jmobius.gameserver.LoginServerThread;
import com.l2jmobius.gameserver.RecipeController; import com.l2jmobius.gameserver.RecipeController;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.ai.L2CharacterAI; import com.l2jmobius.gameserver.ai.L2CharacterAI;
import com.l2jmobius.gameserver.ai.L2PlayerAI; import com.l2jmobius.gameserver.ai.L2PlayerAI;
@@ -821,7 +821,7 @@ public final class L2PcInstance extends L2Playable
if (_PvPRegTask == null) if (_PvPRegTask == null)
{ {
_PvPRegTask = ThreadPoolManager.scheduleAtFixedRate(new PvPFlagTask(this), 1000, 1000); _PvPRegTask = ThreadPool.scheduleAtFixedRate(new PvPFlagTask(this), 1000, 1000);
} }
} }
@@ -2832,7 +2832,7 @@ public final class L2PcInstance extends L2Playable
getAI().setIntention(CtrlIntention.AI_INTENTION_REST); getAI().setIntention(CtrlIntention.AI_INTENTION_REST);
broadcastPacket(new ChangeWaitType(this, ChangeWaitType.WT_SITTING)); broadcastPacket(new ChangeWaitType(this, ChangeWaitType.WT_SITTING));
// Schedule a sit down task to wait for the animation to finish // Schedule a sit down task to wait for the animation to finish
ThreadPoolManager.schedule(new SitDownTask(this), 2500); ThreadPool.schedule(new SitDownTask(this), 2500);
setBlockActions(true); setBlockActions(true);
} }
} }
@@ -2855,7 +2855,7 @@ public final class L2PcInstance extends L2Playable
broadcastPacket(new ChangeWaitType(this, ChangeWaitType.WT_STANDING)); broadcastPacket(new ChangeWaitType(this, ChangeWaitType.WT_STANDING));
// Schedule a stand up task to wait for the animation to finish // Schedule a stand up task to wait for the animation to finish
ThreadPoolManager.schedule(new StandUpTask(this), 2500); ThreadPool.schedule(new StandUpTask(this), 2500);
} }
} }
@@ -7759,7 +7759,7 @@ public final class L2PcInstance extends L2Playable
removeHenna(slot); removeHenna(slot);
continue; continue;
} }
_hennaRemoveSchedules.put(slot, ThreadPoolManager.schedule(new HennaDurationTask(this, slot), System.currentTimeMillis() + remainingTime)); _hennaRemoveSchedules.put(slot, ThreadPool.schedule(new HennaDurationTask(this, slot), System.currentTimeMillis() + remainingTime));
} }
_henna[slot - 1] = henna; _henna[slot - 1] = henna;
@@ -7950,7 +7950,7 @@ public final class L2PcInstance extends L2Playable
final long currentTime = System.currentTimeMillis(); final long currentTime = System.currentTimeMillis();
final long durationInMillis = henna.getDuration() * 60000; final long durationInMillis = henna.getDuration() * 60000;
getVariables().set("HennaDuration" + i, currentTime + durationInMillis); getVariables().set("HennaDuration" + i, currentTime + durationInMillis);
_hennaRemoveSchedules.put(i, ThreadPoolManager.schedule(new HennaDurationTask(this, i), currentTime + durationInMillis)); _hennaRemoveSchedules.put(i, ThreadPool.schedule(new HennaDurationTask(this, i), currentTime + durationInMillis));
} }
// Reward henna skills // Reward henna skills
@@ -8062,7 +8062,7 @@ public final class L2PcInstance extends L2Playable
{ {
if ((Config.CHAR_DATA_STORE_INTERVAL > 0) && (_autoSaveTask == null)) if ((Config.CHAR_DATA_STORE_INTERVAL > 0) && (_autoSaveTask == null))
{ {
_autoSaveTask = ThreadPoolManager.scheduleAtFixedRate(this::autoSave, 300_000L, TimeUnit.MINUTES.toMillis(Config.CHAR_DATA_STORE_INTERVAL)); _autoSaveTask = ThreadPool.scheduleAtFixedRate(this::autoSave, 300_000L, TimeUnit.MINUTES.toMillis(Config.CHAR_DATA_STORE_INTERVAL));
} }
} }
@@ -8671,7 +8671,7 @@ public final class L2PcInstance extends L2Playable
_inventoryDisable = val; _inventoryDisable = val;
if (val) if (val)
{ {
ThreadPoolManager.schedule(new InventoryEnableTask(this), 1500); ThreadPool.schedule(new InventoryEnableTask(this), 1500);
} }
} }
@@ -9487,7 +9487,7 @@ public final class L2PcInstance extends L2Playable
{ {
if (_skillListRefreshTask == null) if (_skillListRefreshTask == null)
{ {
_skillListRefreshTask = ThreadPoolManager.schedule(() -> _skillListRefreshTask = ThreadPool.schedule(() ->
{ {
sendSkillList(0); sendSkillList(0);
_skillListRefreshTask = null; _skillListRefreshTask = null;
@@ -9958,7 +9958,7 @@ public final class L2PcInstance extends L2Playable
{ {
if (_taskWarnUserTakeBreak == null) if (_taskWarnUserTakeBreak == null)
{ {
_taskWarnUserTakeBreak = ThreadPoolManager.scheduleAtFixedRate(new WarnUserTakeBreakTask(this), 3600000, 3600000); _taskWarnUserTakeBreak = ThreadPool.scheduleAtFixedRate(new WarnUserTakeBreakTask(this), 3600000, 3600000);
} }
} }
@@ -9984,7 +9984,7 @@ public final class L2PcInstance extends L2Playable
{ {
if (_taskRentPet == null) if (_taskRentPet == null)
{ {
_taskRentPet = ThreadPoolManager.scheduleAtFixedRate(new RentPetTask(this), seconds * 1000L, seconds * 1000L); _taskRentPet = ThreadPool.scheduleAtFixedRate(new RentPetTask(this), seconds * 1000L, seconds * 1000L);
} }
} }
@@ -10015,7 +10015,7 @@ public final class L2PcInstance extends L2Playable
final int timeinwater = (int) getStat().getValue(Stats.BREATH, 60000); final int timeinwater = (int) getStat().getValue(Stats.BREATH, 60000);
sendPacket(new SetupGauge(getObjectId(), 2, timeinwater)); sendPacket(new SetupGauge(getObjectId(), 2, timeinwater));
_taskWater = ThreadPoolManager.scheduleAtFixedRate(new WaterTask(this), timeinwater, 1000); _taskWater = ThreadPool.scheduleAtFixedRate(new WaterTask(this), timeinwater, 1000);
} }
} }
@@ -10396,7 +10396,7 @@ public final class L2PcInstance extends L2Playable
{ {
if (_teleportWatchdog == null) if (_teleportWatchdog == null)
{ {
_teleportWatchdog = ThreadPoolManager.schedule(new TeleportWatchdogTask(this), Config.TELEPORT_WATCHDOG_TIMEOUT * 1000); _teleportWatchdog = ThreadPool.schedule(new TeleportWatchdogTask(this), Config.TELEPORT_WATCHDOG_TIMEOUT * 1000);
} }
} }
} }
@@ -11290,7 +11290,7 @@ public final class L2PcInstance extends L2Playable
} }
if (_fameTask == null) if (_fameTask == null)
{ {
_fameTask = ThreadPoolManager.scheduleAtFixedRate(new FameTask(this, fameFixRate), delay, delay); _fameTask = ThreadPool.scheduleAtFixedRate(new FameTask(this, fameFixRate), delay, delay);
} }
} }
@@ -11410,7 +11410,7 @@ public final class L2PcInstance extends L2Playable
_soulTask.cancel(false); _soulTask.cancel(false);
_soulTask = null; _soulTask = null;
} }
_soulTask = ThreadPoolManager.schedule(new ResetSoulsTask(this), 600000); _soulTask = ThreadPool.schedule(new ResetSoulsTask(this), 600000);
} }
@@ -11782,7 +11782,7 @@ public final class L2PcInstance extends L2Playable
sendPacket(new SetupGauge(3, (getCurrentFeed() * 10000) / getFeedConsume(), (getMaxFeed() * 10000) / getFeedConsume())); sendPacket(new SetupGauge(3, (getCurrentFeed() * 10000) / getFeedConsume(), (getMaxFeed() * 10000) / getFeedConsume()));
if (!isDead()) if (!isDead())
{ {
_mountFeedTask = ThreadPoolManager.scheduleAtFixedRate(new PetFeedTask(this), 10000, 10000); _mountFeedTask = ThreadPool.scheduleAtFixedRate(new PetFeedTask(this), 10000, 10000);
} }
} }
else if (_canFeed) else if (_canFeed)
@@ -11792,7 +11792,7 @@ public final class L2PcInstance extends L2Playable
sendPacket(sg); sendPacket(sg);
if (!isDead()) if (!isDead())
{ {
_mountFeedTask = ThreadPoolManager.scheduleAtFixedRate(new PetFeedTask(this), 10000, 10000); _mountFeedTask = ThreadPool.scheduleAtFixedRate(new PetFeedTask(this), 10000, 10000);
} }
} }
} }
@@ -11869,7 +11869,7 @@ public final class L2PcInstance extends L2Playable
public void enteredNoLanding(int delay) public void enteredNoLanding(int delay)
{ {
_dismountTask = ThreadPoolManager.schedule(new DismountTask(this), delay * 1000); _dismountTask = ThreadPool.schedule(new DismountTask(this), delay * 1000);
} }
public void exitedNoLanding() public void exitedNoLanding()
@@ -11990,7 +11990,7 @@ public final class L2PcInstance extends L2Playable
_chargeTask.cancel(false); _chargeTask.cancel(false);
_chargeTask = null; _chargeTask = null;
} }
_chargeTask = ThreadPoolManager.schedule(new ResetChargesTask(this), 600000); _chargeTask = ThreadPool.schedule(new ResetChargesTask(this), 600000);
} }
/** /**
@@ -13029,7 +13029,7 @@ public final class L2PcInstance extends L2Playable
public void startRecoGiveTask() public void startRecoGiveTask()
{ {
// Create task to give new recommendations // Create task to give new recommendations
_recoGiveTask = ThreadPoolManager.scheduleAtFixedRate(new RecoGiveTask(this), 7200000, 3600000); _recoGiveTask = ThreadPool.scheduleAtFixedRate(new RecoGiveTask(this), 7200000, 3600000);
// Store new data // Store new data
storeRecommendations(); storeRecommendations();
@@ -13970,7 +13970,7 @@ public final class L2PcInstance extends L2Playable
stopOnlineTimeUpdateTask(); stopOnlineTimeUpdateTask();
} }
_onlineTimeUpdateTask = ThreadPoolManager.scheduleAtFixedRate(this::updateOnlineTime, 60 * 1000L, 60 * 1000L); _onlineTimeUpdateTask = ThreadPool.scheduleAtFixedRate(this::updateOnlineTime, 60 * 1000L, 60 * 1000L);
} }
private void updateOnlineTime() private void updateOnlineTime()
@@ -29,9 +29,9 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable; import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable;
import com.l2jmobius.gameserver.data.sql.impl.SummonEffectsTable; import com.l2jmobius.gameserver.data.sql.impl.SummonEffectsTable;
@@ -1133,7 +1133,7 @@ public class L2PetInstance extends L2Summon
stopFeed(); stopFeed();
if (!isDead() && (getOwner().getPet() == this)) if (!isDead() && (getOwner().getPet() == this))
{ {
_feedTask = ThreadPoolManager.scheduleAtFixedRate(new FeedTask(), 10000, 10000); _feedTask = ThreadPool.scheduleAtFixedRate(new FeedTask(), 10000, 10000);
} }
} }
@@ -20,8 +20,8 @@ import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.MonsterRace; import com.l2jmobius.gameserver.MonsterRace;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.idfactory.IdFactory; import com.l2jmobius.gameserver.idfactory.IdFactory;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -106,26 +106,26 @@ public class L2RaceManagerInstance extends L2Npc
_managers = new CopyOnWriteArrayList<>(); _managers = new CopyOnWriteArrayList<>();
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKETS_ARE_NOW_AVAILABLE_FOR_MONSTER_RACE_S1), 0, 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKETS_ARE_NOW_AVAILABLE_FOR_MONSTER_RACE_S1), 0, 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.NOW_SELLING_TICKETS_FOR_MONSTER_RACE_S1), 30 * SECOND, 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.NOW_SELLING_TICKETS_FOR_MONSTER_RACE_S1), 30 * SECOND, 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKETS_ARE_NOW_AVAILABLE_FOR_MONSTER_RACE_S1), MINUTE, 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKETS_ARE_NOW_AVAILABLE_FOR_MONSTER_RACE_S1), MINUTE, 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.NOW_SELLING_TICKETS_FOR_MONSTER_RACE_S1), MINUTE + (30 * SECOND), 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.NOW_SELLING_TICKETS_FOR_MONSTER_RACE_S1), MINUTE + (30 * SECOND), 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKET_SALES_FOR_THE_MONSTER_RACE_WILL_END_IN_S1_MINUTE_S), 2 * MINUTE, 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKET_SALES_FOR_THE_MONSTER_RACE_WILL_END_IN_S1_MINUTE_S), 2 * MINUTE, 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKET_SALES_FOR_THE_MONSTER_RACE_WILL_END_IN_S1_MINUTE_S), 3 * MINUTE, 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKET_SALES_FOR_THE_MONSTER_RACE_WILL_END_IN_S1_MINUTE_S), 3 * MINUTE, 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKET_SALES_FOR_THE_MONSTER_RACE_WILL_END_IN_S1_MINUTE_S), 4 * MINUTE, 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKET_SALES_FOR_THE_MONSTER_RACE_WILL_END_IN_S1_MINUTE_S), 4 * MINUTE, 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKET_SALES_FOR_THE_MONSTER_RACE_WILL_END_IN_S1_MINUTE_S), 5 * MINUTE, 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKET_SALES_FOR_THE_MONSTER_RACE_WILL_END_IN_S1_MINUTE_S), 5 * MINUTE, 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKET_SALES_FOR_THE_MONSTER_RACE_WILL_END_IN_S1_MINUTE_S), 6 * MINUTE, 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKET_SALES_FOR_THE_MONSTER_RACE_WILL_END_IN_S1_MINUTE_S), 6 * MINUTE, 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKETS_SALES_ARE_CLOSED_FOR_MONSTER_RACE_S1_ODDS_ARE_POSTED), 7 * MINUTE, 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKETS_SALES_ARE_CLOSED_FOR_MONSTER_RACE_S1_ODDS_ARE_POSTED), 7 * MINUTE, 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.MONSTER_RACE_S2_WILL_BEGIN_IN_S1_MINUTE_S), 7 * MINUTE, 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.MONSTER_RACE_S2_WILL_BEGIN_IN_S1_MINUTE_S), 7 * MINUTE, 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.MONSTER_RACE_S2_WILL_BEGIN_IN_S1_MINUTE_S), 8 * MINUTE, 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.MONSTER_RACE_S2_WILL_BEGIN_IN_S1_MINUTE_S), 8 * MINUTE, 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.MONSTER_RACE_S1_WILL_BEGIN_IN_30_SECONDS), (8 * MINUTE) + (30 * SECOND), 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.MONSTER_RACE_S1_WILL_BEGIN_IN_30_SECONDS), (8 * MINUTE) + (30 * SECOND), 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.MONSTER_RACE_S1_IS_ABOUT_TO_BEGIN_COUNTDOWN_IN_FIVE_SECONDS), (8 * MINUTE) + (50 * SECOND), 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.MONSTER_RACE_S1_IS_ABOUT_TO_BEGIN_COUNTDOWN_IN_FIVE_SECONDS), (8 * MINUTE) + (50 * SECOND), 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.THE_RACE_WILL_BEGIN_IN_S1_SECOND_S), (8 * MINUTE) + (55 * SECOND), 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.THE_RACE_WILL_BEGIN_IN_S1_SECOND_S), (8 * MINUTE) + (55 * SECOND), 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.THE_RACE_WILL_BEGIN_IN_S1_SECOND_S), (8 * MINUTE) + (56 * SECOND), 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.THE_RACE_WILL_BEGIN_IN_S1_SECOND_S), (8 * MINUTE) + (56 * SECOND), 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.THE_RACE_WILL_BEGIN_IN_S1_SECOND_S), (8 * MINUTE) + (57 * SECOND), 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.THE_RACE_WILL_BEGIN_IN_S1_SECOND_S), (8 * MINUTE) + (57 * SECOND), 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.THE_RACE_WILL_BEGIN_IN_S1_SECOND_S), (8 * MINUTE) + (58 * SECOND), 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.THE_RACE_WILL_BEGIN_IN_S1_SECOND_S), (8 * MINUTE) + (58 * SECOND), 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.THE_RACE_WILL_BEGIN_IN_S1_SECOND_S), (8 * MINUTE) + (59 * SECOND), 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.THE_RACE_WILL_BEGIN_IN_S1_SECOND_S), (8 * MINUTE) + (59 * SECOND), 10 * MINUTE);
ThreadPoolManager.scheduleAtFixedRate(new Announcement(SystemMessageId.THEY_RE_OFF), 9 * MINUTE, 10 * MINUTE); ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.THEY_RE_OFF), 9 * MINUTE, 10 * MINUTE);
} }
_managers.add(this); _managers.add(this);
} }
@@ -253,7 +253,7 @@ public class L2RaceManagerInstance extends L2Npc
_packet = new MonRaceInfo(_codes[1][0], _codes[1][1], race.getMonsters(), race.getSpeeds()); _packet = new MonRaceInfo(_codes[1][0], _codes[1][1], race.getMonsters(), race.getSpeeds());
sendMonsterInfo(); sendMonsterInfo();
ThreadPoolManager.schedule(new RunRace(), 5000); ThreadPool.schedule(new RunRace(), 5000);
} }
else else
{ {
@@ -558,7 +558,7 @@ public class L2RaceManagerInstance extends L2Npc
{ {
_packet = new MonRaceInfo(_codes[2][0], _codes[2][1], MonsterRace.getInstance().getMonsters(), MonsterRace.getInstance().getSpeeds()); _packet = new MonRaceInfo(_codes[2][0], _codes[2][1], MonsterRace.getInstance().getMonsters(), MonsterRace.getInstance().getSpeeds());
sendMonsterInfo(); sendMonsterInfo();
ThreadPoolManager.schedule(new RunEnd(), 30000); ThreadPool.schedule(new RunEnd(), 30000);
} }
} }
@@ -17,8 +17,8 @@
package com.l2jmobius.gameserver.model.actor.instance; package com.l2jmobius.gameserver.model.actor.instance;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.L2Spawn;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
@@ -72,7 +72,7 @@ public class L2RaidBossInstance extends L2MonsterInstance
@Override @Override
protected void startMaintenanceTask() protected void startMaintenanceTask()
{ {
_maintenanceTask = ThreadPoolManager.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000));
} }
protected void checkAndReturnToSpawn() protected void checkAndReturnToSpawn()
@@ -29,8 +29,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable; import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable;
import com.l2jmobius.gameserver.data.sql.impl.SummonEffectsTable; import com.l2jmobius.gameserver.data.sql.impl.SummonEffectsTable;
@@ -85,7 +85,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
super.onSpawn(); super.onSpawn();
if ((_lifeTime > 0) && (_summonLifeTask == null)) if ((_lifeTime > 0) && (_summonLifeTask == null))
{ {
_summonLifeTask = ThreadPoolManager.scheduleAtFixedRate(this, 0, 5000); _summonLifeTask = ThreadPool.scheduleAtFixedRate(this, 0, 5000);
} }
} }
@@ -16,7 +16,7 @@
*/ */
package com.l2jmobius.gameserver.model.actor.instance; package com.l2jmobius.gameserver.model.actor.instance;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.instancemanager.FortSiegeManager; import com.l2jmobius.gameserver.instancemanager.FortSiegeManager;
@@ -163,7 +163,7 @@ public class L2SiegeFlagInstance extends L2Npc
// send warning to owners of headquarters that theirs base is under attack // send warning to owners of headquarters that theirs base is under attack
_clan.broadcastToOnlineMembers(SystemMessage.getSystemMessage(SystemMessageId.YOUR_BASE_IS_BEING_ATTACKED)); _clan.broadcastToOnlineMembers(SystemMessage.getSystemMessage(SystemMessageId.YOUR_BASE_IS_BEING_ATTACKED));
setCanTalk(false); setCanTalk(false);
ThreadPoolManager.schedule(new ScheduleTalkTask(), 20000); ThreadPool.schedule(new ScheduleTalkTask(), 20000);
} }
} }
} }
@@ -22,8 +22,8 @@ import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.data.xml.impl.NpcData; import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillData;
@@ -153,7 +153,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
{ {
_durationCheckTask.cancel(true); _durationCheckTask.cancel(true);
} }
_durationCheckTask = ThreadPoolManager.scheduleAtFixedRate(new CheckDuration(this), DURATION_CHECK_INTERVAL, DURATION_CHECK_INTERVAL); _durationCheckTask = ThreadPool.scheduleAtFixedRate(new CheckDuration(this), DURATION_CHECK_INTERVAL, DURATION_CHECK_INTERVAL);
} }
} }
@@ -217,10 +217,10 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
int delay = 100; int delay = 100;
for (Skill skill : _beastSkills) for (Skill skill : _beastSkills)
{ {
ThreadPoolManager.schedule(new buffCast(skill), delay); ThreadPool.schedule(new buffCast(skill), delay);
delay += (100 + skill.getHitTime()); delay += (100 + skill.getHitTime());
} }
ThreadPoolManager.schedule(new buffCast(null), delay); ThreadPool.schedule(new buffCast(null), delay);
} }
private class buffCast implements Runnable private class buffCast implements Runnable
@@ -284,7 +284,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
{ {
_buffTask.cancel(true); _buffTask.cancel(true);
} }
_buffTask = ThreadPoolManager.scheduleAtFixedRate(new CheckOwnerBuffs(this, totalBuffsAvailable), BUFF_INTERVAL, BUFF_INTERVAL); _buffTask = ThreadPool.scheduleAtFixedRate(new CheckOwnerBuffs(this, totalBuffsAvailable), BUFF_INTERVAL, BUFF_INTERVAL);
} }
} }
else else
@@ -20,7 +20,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.enums.TrapAction; import com.l2jmobius.gameserver.enums.TrapAction;
import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager;
@@ -77,7 +77,7 @@ public final class L2TrapInstance extends L2Npc
_remainingTime = _lifeTime; _remainingTime = _lifeTime;
if (_skill != null) if (_skill != null)
{ {
_trapTask = ThreadPoolManager.scheduleAtFixedRate(new TrapTask(this), TICK, TICK); _trapTask = ThreadPool.scheduleAtFixedRate(new TrapTask(this), TICK, TICK);
} }
} }
@@ -339,7 +339,7 @@ public final class L2TrapInstance extends L2Npc
EventDispatcher.getInstance().notifyEventAsync(new OnTrapAction(this, target, TrapAction.TRAP_TRIGGERED), this); EventDispatcher.getInstance().notifyEventAsync(new OnTrapAction(this, target, TrapAction.TRAP_TRIGGERED), this);
ThreadPoolManager.schedule(new TrapTriggerTask(this), 500); ThreadPool.schedule(new TrapTriggerTask(this), 500);
} }
public void unSummon() public void unSummon()
@@ -19,7 +19,7 @@ package com.l2jmobius.gameserver.model.actor.request;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/** /**
@@ -55,7 +55,7 @@ public abstract class AbstractRequest
public void scheduleTimeout(long delay) public void scheduleTimeout(long delay)
{ {
_timeOutTask = ThreadPoolManager.schedule(this::onTimeout, delay); _timeOutTask = ThreadPool.schedule(this::onTimeout, delay);
} }
public boolean isTimeout() public boolean isTimeout()
@@ -23,7 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.stat.CharStat; import com.l2jmobius.gameserver.model.actor.stat.CharStat;
@@ -210,7 +210,7 @@ public class CharStatus
final int period = Formulas.getRegeneratePeriod(getActiveChar()); final int period = Formulas.getRegeneratePeriod(getActiveChar());
// Create the HP/MP/CP Regeneration task // Create the HP/MP/CP Regeneration task
_regTask = ThreadPoolManager.scheduleAtFixedRate(new RegenTask(), period, period); _regTask = ThreadPool.scheduleAtFixedRate(new RegenTask(), period, period);
} }
} }
@@ -17,7 +17,7 @@
package com.l2jmobius.gameserver.model.actor.tasks.attackable; package com.l2jmobius.gameserver.model.actor.tasks.attackable;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Attackable;
/** /**
@@ -48,7 +48,7 @@ public final class CommandChannelTimer implements Runnable
} }
else else
{ {
ThreadPoolManager.schedule(this, 10000); // 10sec ThreadPool.schedule(this, 10000); // 10sec
} }
} }
@@ -22,8 +22,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
/** /**
@@ -91,7 +91,7 @@ public class RandomAnimationTask implements Runnable
final int interval = Rnd.get(minWait, maxWait) * 1000; final int interval = Rnd.get(minWait, maxWait) * 1000;
// Create a RandomAnimation Task that will be launched after the calculated delay // Create a RandomAnimation Task that will be launched after the calculated delay
ThreadPoolManager.schedule(this, interval); ThreadPool.schedule(this, interval);
} }
/** /**
@@ -16,7 +16,7 @@
*/ */
package com.l2jmobius.gameserver.model.actor.tasks.npc.trap; package com.l2jmobius.gameserver.model.actor.tasks.npc.trap;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance; import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
/** /**
@@ -38,7 +38,7 @@ public class TrapTriggerTask implements Runnable
try try
{ {
_trap.doCast(_trap.getSkill()); _trap.doCast(_trap.getSkill());
ThreadPoolManager.schedule(new TrapUnsummonTask(_trap), _trap.getSkill().getHitTime() + 300); ThreadPool.schedule(new TrapUnsummonTask(_trap), _trap.getSkill().getHitTime() + 300);
} }
catch (Exception e) catch (Exception e)
{ {
@@ -18,7 +18,7 @@ package com.l2jmobius.gameserver.model.actor.tasks.player;
import java.util.Objects; import java.util.Objects;
import com.l2jmobius.gameserver.ThreadPoolManager; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.request.SayuneRequest; import com.l2jmobius.gameserver.model.actor.request.SayuneRequest;
import com.l2jmobius.gameserver.model.zone.L2ZoneType; import com.l2jmobius.gameserver.model.zone.L2ZoneType;
@@ -51,7 +51,7 @@ public class FlyMoveStartTask implements Runnable
if (!_player.hasRequest(SayuneRequest.class)) if (!_player.hasRequest(SayuneRequest.class))
{ {
_player.sendPacket(ExNotifyFlyMoveStart.STATIC_PACKET); _player.sendPacket(ExNotifyFlyMoveStart.STATIC_PACKET);
ThreadPoolManager.schedule(this, 1000L); ThreadPool.schedule(this, 1000L);
} }
} }
} }
@@ -25,8 +25,8 @@ import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level; import java.util.logging.Level;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.util.Broadcast; import com.l2jmobius.gameserver.util.Broadcast;
/** /**
@@ -160,7 +160,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
_task.cancel(false); _task.cancel(false);
} }
_currentState = _repeat; _currentState = _repeat;
_task = ThreadPoolManager.schedule(this, _initial); _task = ThreadPool.schedule(this, _initial);
} }
@Override @Override
@@ -178,7 +178,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
_currentState--; _currentState--;
} }
_task = ThreadPoolManager.schedule(this, _delay); _task = ThreadPool.schedule(this, _delay);
} }
} }
} }
@@ -26,8 +26,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.model.items.L2Item; import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.type.EtcItemType; import com.l2jmobius.gameserver.model.items.type.EtcItemType;
@@ -124,7 +124,7 @@ public final class Product
} }
if ((_restockTask == null) || _restockTask.isDone()) if ((_restockTask == null) || _restockTask.isDone())
{ {
_restockTask = ThreadPoolManager.schedule(this::restock, getRestockDelay()); _restockTask = ThreadPool.schedule(this::restock, getRestockDelay());
} }
final boolean result = _count.addAndGet(-val) >= 0; final boolean result = _count.addAndGet(-val) >= 0;
save(); save();
@@ -141,7 +141,7 @@ public final class Product
final long remainTime = nextRestockTime - System.currentTimeMillis(); final long remainTime = nextRestockTime - System.currentTimeMillis();
if (remainTime > 0) if (remainTime > 0)
{ {
_restockTask = ThreadPoolManager.schedule(this::restock, remainTime); _restockTask = ThreadPool.schedule(this::restock, remainTime);
} }
else else
{ {
@@ -21,8 +21,8 @@ import java.util.concurrent.ScheduledFuture;
import java.util.stream.Stream; import java.util.stream.Stream;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.L2Party;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
@@ -54,8 +54,8 @@ public class CubicInstance
private void activate() private void activate()
{ {
_skillUseTask = ThreadPoolManager.scheduleAtFixedRate(this::readyToUseSkill, 0, _template.getDelay() * 1000); _skillUseTask = ThreadPool.scheduleAtFixedRate(this::readyToUseSkill, 0, _template.getDelay() * 1000);
_expireTask = ThreadPoolManager.schedule(this::deactivate, _template.getDuration() * 1000); _expireTask = ThreadPool.schedule(this::deactivate, _template.getDuration() * 1000);
} }
public void deactivate() public void deactivate()
@@ -24,8 +24,8 @@ import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.NpcData; import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.datatables.SpawnTable; import com.l2jmobius.gameserver.datatables.SpawnTable;
@@ -304,7 +304,7 @@ public final class BlockCheckerEngine
_abnormalEnd = true; _abnormalEnd = true;
ThreadPoolManager.execute(new EndEvent()); ThreadPool.execute(new EndEvent());
} }
} }
catch (Exception e) catch (Exception e)
@@ -422,7 +422,7 @@ public final class BlockCheckerEngine
} }
_isStarted = true; _isStarted = true;
// Spawn the blocks // Spawn the blocks
ThreadPoolManager.execute(new SpawnRound(16, 1)); ThreadPool.execute(new SpawnRound(16, 1));
// Start up player parameters // Start up player parameters
setUpPlayers(); setUpPlayers();
// Set the started time // Set the started time
@@ -457,19 +457,19 @@ public final class BlockCheckerEngine
case 1: case 1:
{ {
// Schedule second spawn round // Schedule second spawn round
_task = ThreadPoolManager.schedule(new SpawnRound(20, 2), 60000); _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000);
break; break;
} }
case 2: case 2:
{ {
// Schedule third spawn round // Schedule third spawn round
_task = ThreadPoolManager.schedule(new SpawnRound(14, 3), 60000); _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000);
break; break;
} }
case 3: case 3:
{ {
// Schedule Event End Count Down // Schedule Event End Count Down
_task = ThreadPoolManager.schedule(new EndEvent(), 180000); _task = ThreadPool.schedule(new EndEvent(), 180000);
break; break;
} }
} }
@@ -529,7 +529,7 @@ public final class BlockCheckerEngine
SpawnTable.getInstance().addNewSpawn(girlSpawn, false); SpawnTable.getInstance().addNewSpawn(girlSpawn, false);
girlSpawn.init(); girlSpawn.init();
// Schedule his deletion after 9 secs of spawn // Schedule his deletion after 9 secs of spawn
ThreadPoolManager.schedule(new CarryingGirlUnspawn(girlSpawn), 9000); ThreadPool.schedule(new CarryingGirlUnspawn(girlSpawn), 9000);
} }
catch (Exception e) catch (Exception e)
{ {
@@ -29,8 +29,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
import com.l2jmobius.gameserver.data.xml.impl.CastleData; import com.l2jmobius.gameserver.data.xml.impl.CastleData;
import com.l2jmobius.gameserver.data.xml.impl.DoorData; import com.l2jmobius.gameserver.data.xml.impl.DoorData;
@@ -165,11 +165,11 @@ public final class Castle extends AbstractResidence
final long currentTime = System.currentTimeMillis(); final long currentTime = System.currentTimeMillis();
if (_endDate > currentTime) if (_endDate > currentTime)
{ {
ThreadPoolManager.schedule(new FunctionTask(cwh), _endDate - currentTime); ThreadPool.schedule(new FunctionTask(cwh), _endDate - currentTime);
} }
else else
{ {
ThreadPoolManager.schedule(new FunctionTask(cwh), 0); ThreadPool.schedule(new FunctionTask(cwh), 0);
} }
} }
@@ -203,7 +203,7 @@ public final class Castle extends AbstractResidence
{ {
ClanTable.getInstance().getClan(getOwnerId()).getWarehouse().destroyItemByItemId("CS_function_fee", Inventory.ADENA_ID, fee, null, null); ClanTable.getInstance().getClan(getOwnerId()).getWarehouse().destroyItemByItemId("CS_function_fee", Inventory.ADENA_ID, fee, null, null);
} }
ThreadPoolManager.schedule(new FunctionTask(true), getRate()); ThreadPool.schedule(new FunctionTask(true), getRate());
} }
else else
{ {
@@ -29,8 +29,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData;
import com.l2jmobius.gameserver.enums.ClanHallGrade; import com.l2jmobius.gameserver.enums.ClanHallGrade;
@@ -263,7 +263,7 @@ public final class ClanHall extends AbstractResidence
final int failDays = getCostFailDay(); final int failDays = getCostFailDay();
final long time = failDays > 0 ? (failDays > 8 ? Instant.now().toEpochMilli() : Instant.ofEpochMilli(getPaidUntil()).plus(Duration.ofDays(failDays + 1)).toEpochMilli()) : getPaidUntil(); final long time = failDays > 0 ? (failDays > 8 ? Instant.now().toEpochMilli() : Instant.ofEpochMilli(getPaidUntil()).plus(Duration.ofDays(failDays + 1)).toEpochMilli()) : getPaidUntil();
_checkPaymentTask = ThreadPoolManager.schedule(new CheckPaymentTask(), time - System.currentTimeMillis()); _checkPaymentTask = ThreadPool.schedule(new CheckPaymentTask(), time - System.currentTimeMillis());
} }
else else
{ {
@@ -363,7 +363,7 @@ public final class ClanHall extends AbstractResidence
} }
else else
{ {
_checkPaymentTask = ThreadPoolManager.schedule(new CheckPaymentTask(), 24 * 60 * 60 * 1000); // 1 day _checkPaymentTask = ThreadPool.schedule(new CheckPaymentTask(), 24 * 60 * 60 * 1000); // 1 day
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.PAYMENT_FOR_YOUR_CLAN_HALL_HAS_NOT_BEEN_MADE_PLEASE_MAKE_PAYMENT_TO_YOUR_CLAN_WAREHOUSE_BY_S1_TOMORROW); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.PAYMENT_FOR_YOUR_CLAN_HALL_HAS_NOT_BEEN_MADE_PLEASE_MAKE_PAYMENT_TO_YOUR_CLAN_WAREHOUSE_BY_S1_TOMORROW);
sm.addInt(getLease()); sm.addInt(getLease());
clan.broadcastToOnlineMembers(sm); clan.broadcastToOnlineMembers(sm);
@@ -373,7 +373,7 @@ public final class ClanHall extends AbstractResidence
{ {
clan.getWarehouse().destroyItem("Clan Hall Lease", Inventory.ADENA_ID, getLease(), null, null); clan.getWarehouse().destroyItem("Clan Hall Lease", Inventory.ADENA_ID, getLease(), null, null);
setPaidUntil(Instant.ofEpochMilli(getPaidUntil()).plus(Duration.ofDays(7)).toEpochMilli()); setPaidUntil(Instant.ofEpochMilli(getPaidUntil()).plus(Duration.ofDays(7)).toEpochMilli());
_checkPaymentTask = ThreadPoolManager.schedule(new CheckPaymentTask(), getPaidUntil() - System.currentTimeMillis()); _checkPaymentTask = ThreadPool.schedule(new CheckPaymentTask(), getPaidUntil() - System.currentTimeMillis());
updateDB(); updateDB();
} }
} }

Some files were not shown because too many files have changed in this diff Show More