rendered paste bodyIndex: C:/workspace/C4-Alpha/java/net/sf/l2j/status/GameStatusThread.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/status/GameStatusThread.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/status/GameStatusThread.java (working copy)
@@ -255,6 +255,14 @@
}
_print.flush();
}
+ else if (_usrCommand.equals("extended_performance") || _usrCommand.equals("extended") )
+ {
+ for (String line : ClientScheduler.getInstance().getExtendedStats())
+ {
+ _print.println(line);
+ }
+ _print.flush();
+ }
else if (_usrCommand.startsWith("announce"))
{
try
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/Config.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/Config.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/Config.java (working copy)
@@ -75,6 +75,16 @@
public static int THREAD_P_MED;
public static int THREAD_P_LOW;
+ /** Thread pools size - new method */
+ public static int THREAD_P_SYSTEM;
+ public static int THREAD_P_POTION;
+ public static int THREAD_P_SKILL;
+ public static int THREAD_P_AI;
+ public static int THREAD_P_SIEGEAI;
+ public static int THREAD_P_CRAFT;
+ public static int THREAD_P_QUEST;
+ public static int THREAD_P_OTHER;
+
/** Auto-loot? */
public static boolean AUTO_LOOT;
@@ -408,7 +418,16 @@
public static int EXECUTOR_PRI_MED;
public static int EXECUTOR_PRI_HIGH;
+ public static int EXECUTOR_PRI_SYSTEM;
+ public static int EXECUTOR_PRI_POTION;
+ public static int EXECUTOR_PRI_SKILL;
+ public static int EXECUTOR_PRI_AI;
+ public static int EXECUTOR_PRI_SIEGEAI;
+ public static int EXECUTOR_PRI_CRAFT;
+ public static int EXECUTOR_PRI_QUEST;
+ public static int EXECUTOR_PRI_OTHER;
+
public static enum IdFactoryType
{
Compaction,
@@ -633,6 +652,15 @@
THREAD_P_HIGH = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeHigh", "4"));
THREAD_P_MED = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeMed", "10"));
THREAD_P_LOW = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeLow", "4"));
+
+ THREAD_P_SYSTEM = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeSystem", "4"));
+ THREAD_P_POTION = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizePotion", "4"));
+ THREAD_P_SKILL = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeSkill", "4"));
+ THREAD_P_AI = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeAi", "4"));
+ THREAD_P_SIEGEAI = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeSiegeAi", "4"));
+ THREAD_P_CRAFT = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeCraft", "4"));
+ THREAD_P_QUEST = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeQuest", "4"));
+ THREAD_P_OTHER = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeOther", "4"));
MAXIMUM_ONLINE_USERS = Integer.parseInt(serverSettings.getProperty("MaximumOnlineUsers", "100"));
@@ -666,7 +694,17 @@
EXECUTOR_PRI_LOW = Integer.parseInt(serverSettings.getProperty("ExecutorPriLow", "-1"));
EXECUTOR_PRI_MED = Integer.parseInt(serverSettings.getProperty("ExecutorPriMed", "0"));
EXECUTOR_PRI_HIGH = Integer.parseInt(serverSettings.getProperty("ExecutorPriHigh", "1"));
+
+ EXECUTOR_PRI_SYSTEM = Integer.parseInt(serverSettings.getProperty("ExecutorPriSystem", "1"));
+ EXECUTOR_PRI_POTION = Integer.parseInt(serverSettings.getProperty("ExecutorPriPotion", "-1"));
+ EXECUTOR_PRI_SKILL = Integer.parseInt(serverSettings.getProperty("ExecutorPriSkill", "-1"));
+ EXECUTOR_PRI_AI = Integer.parseInt(serverSettings.getProperty("ExecutorPriAi", "0"));
+ EXECUTOR_PRI_SIEGEAI = Integer.parseInt(serverSettings.getProperty("ExecutorPriSiegeAi", "0"));
+ EXECUTOR_PRI_CRAFT = Integer.parseInt(serverSettings.getProperty("ExecutorPriCraft", "-1"));
+ EXECUTOR_PRI_QUEST = Integer.parseInt(serverSettings.getProperty("ExecutorPriQuest", "-1"));
+ EXECUTOR_PRI_OTHER = Integer.parseInt(serverSettings.getProperty("ExecutorPriOther", "0"));
+
DEFAULT_PUNISH = Integer.parseInt(serverSettings.getProperty("DefaultPunish", "2"));
BYPASS_VALIDATION = Boolean.valueOf(serverSettings.getProperty("BypassValidation", "False"));
}
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/loginserver/ClientThread.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/loginserver/ClientThread.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/loginserver/ClientThread.java (working copy)
@@ -413,7 +413,7 @@
_bannedIPs.add(ip);
int time = incorrectCount * incorrectCount * 1000;
//System.out.println("Banning ip "+ip+" for "+time/1000.0+" seconds.");
- ClientScheduler.getInstance().scheduleMed(new UnbanTask(ip), time);
+ ClientScheduler.getInstance().scheduleSystem(new UnbanTask(ip), time);
}
public static void addBannedIP(String ip)
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/Connection.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/Connection.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/Connection.java (working copy)
@@ -90,16 +90,8 @@
public synchronized void addReceivedMsg(ByteBuffer buf) {
if (Config.ASSERT) assert Thread.currentThread() == SelectorThread.instance;
ClientBasePacket pkt = PacketHandler.handlePacket(buf, _client);
- if (pkt != null) {
- if (pkt.getPriority() == TaskPriority.PR_URGENT)
- {
- pkt.run();
- }
- else
- {
+ if (pkt != null)
ClientScheduler.addReceivedMsg(pkt);
- }
- }
}
/** Get next message, received received by NIO's thread, if any.
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/clientpackets/RequestRestartPoint.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/clientpackets/RequestRestartPoint.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/clientpackets/RequestRestartPoint.java (working copy)
@@ -119,25 +119,24 @@
&& castle.getSiege().checkIsAttacker(activeChar.getClan()))
{
// Schedule respawn delay for attacker
- ClientScheduler.getInstance().scheduleLow(new DeathTask(activeChar), castle.getSiege().getAttackerRespawnDelay());
+ ClientScheduler.getInstance().scheduleSiegeAi(new DeathTask(activeChar), castle.getSiege().getAttackerRespawnDelay());
sm.addString("You will be re-spawned in " + castle.getSiege().getAttackerRespawnDelay()/1000 + " seconds");
activeChar.sendPacket(sm);
}
else
{
// Schedule respawn delay for defender with penalty for CT lose
- ClientScheduler.getInstance().scheduleLow(new DeathTask(activeChar), castle.getSiege().getDefenderRespawnDelay());
+ ClientScheduler.getInstance().scheduleSiegeAi(new DeathTask(activeChar), castle.getSiege().getDefenderRespawnDelay());
sm.addString("You will be re-spawned in " + castle.getSiege().getDefenderRespawnDelay()/1000 + " seconds");
activeChar.sendPacket(sm);
}
return;
}
- ClientScheduler.getInstance().scheduleLow(new DeathTask(activeChar), 1);
+ ClientScheduler.getInstance().scheduleSiegeAi(new DeathTask(activeChar), 1);
}
+
-
-
/* (non-Javadoc)
* @see net.sf.l2j.gameserver.clientpackets.ClientBasePacket#getType()
*/
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/SevenSignsFestival.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/SevenSignsFestival.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/SevenSignsFestival.java (working copy)
@@ -964,7 +964,7 @@
// at the specified time, then invoke it automatically after every cycle.
FestivalManager fm = new FestivalManager();
setNextFestivalStart(FESTIVAL_MANAGER_START + FESTIVAL_SIGNUP_TIME);
- _managerScheduledTask = ClientScheduler.getInstance().scheduleMedAtFixedRate(fm, FESTIVAL_MANAGER_START, FESTIVAL_CYCLE_LENGTH);
+ _managerScheduledTask = ClientScheduler.getInstance().scheduleOtherAtFixedRate(fm, FESTIVAL_MANAGER_START, FESTIVAL_CYCLE_LENGTH);
_log.info("SevenSignsFestival: The first Festival of Darkness cycle begins in " + (FESTIVAL_MANAGER_START / 1000 / 60) + " minute(s).");
}
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ItemsAutoDestroy.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ItemsAutoDestroy.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ItemsAutoDestroy.java (working copy)
@@ -38,7 +38,7 @@
_sleep = Config.AUTODESTROY_ITEM_AFTER * 1000;
if(_sleep == 0) // it should not happend as it is not called when AUTODESTROY_ITEM_AFTER = 0 but we never know..
_sleep = 3600 * 1000;
- ClientScheduler.getInstance().scheduleMedAtFixedRate(new CheckItemsForDestroy(),_sleep,_sleep);
+ ClientScheduler.getInstance().scheduleOtherAtFixedRate(new CheckItemsForDestroy(),_sleep,_sleep);
}
public static ItemsAutoDestroy getInstance()
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/ScrollOfEscape.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/ScrollOfEscape.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/ScrollOfEscape.java (working copy)
@@ -86,7 +86,7 @@
activeChar.removeItemFromInventory(item, 1);
EscapeFinalizer ef = new EscapeFinalizer(activeChar, item.getItemId());
// continue execution later
- activeChar.setSkillCast(ClientScheduler.getInstance().scheduleLow(ef, skill.getSkillTime()));
+ activeChar.setSkillCast(ClientScheduler.getInstance().scheduleSkill(ef, skill.getSkillTime()));
activeChar.setSkillCastEndTime(10+GameTimeController.getGameTicks()+skill.getSkillTime()/GameTimeController.MILLIS_IN_TICK);
}
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/MysteryPotion.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/MysteryPotion.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/MysteryPotion.java (working copy)
@@ -59,7 +59,7 @@
activeChar.sendPacket(sm);
MysteryPotionStop mp = new MysteryPotionStop(playable);
- ClientScheduler.getInstance().scheduleLow(mp, _effectDuration);
+ ClientScheduler.getInstance().schedulePotion(mp, _effectDuration);
}
public class MysteryPotionStop implements Runnable
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/SoulCrystals.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/SoulCrystals.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/SoulCrystals.java (working copy)
@@ -85,7 +85,7 @@
// Continue execution later
CrystalFinalizer cf = new CrystalFinalizer(activeChar, target, crystalId);
- ClientScheduler.getInstance().scheduleLow(cf, skill.getSkillTime());
+ ClientScheduler.getInstance().scheduleSkill(cf, skill.getSkillTime());
}
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/PetSummon.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/PetSummon.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/PetSummon.java (working copy)
@@ -158,7 +158,7 @@
newpet.startFeed();
// continue execution in 1 seconds
- ClientScheduler.getInstance().scheduleLow(new SummonFinalizer(activeChar, newpet), 900);
+ ClientScheduler.getInstance().scheduleOther(new SummonFinalizer(activeChar, newpet), 900);
}
static class SummonFinalizer implements Runnable
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/ScrollOfResurrection.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/ScrollOfResurrection.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/itemhandlers/ScrollOfResurrection.java (working copy)
@@ -139,7 +139,7 @@
activeChar.removeItemFromInventory(item, 1);
//ResurrectFinalizer rf = new ResurrectFinalizer(target);
// continue execution later
- //ClientScheduler.getInstance().scheduleLow(rf, skill.getSkillTime() - 200);
+ //ClientScheduler.getInstance().scheduleSkill(rf, skill.getSkillTime() - 200);
}
}
}
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java (working copy)
@@ -64,7 +64,7 @@
EscapeFinalizer ef = new EscapeFinalizer(activeChar);
// continue execution later
- ClientScheduler.getInstance().scheduleLow(ef, unstuckTimer);
+ ClientScheduler.getInstance().scheduleOther(ef, unstuckTimer);
return true;
}
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminMonsterRace.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminMonsterRace.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminMonsterRace.java (working copy)
@@ -114,7 +114,7 @@
activeChar.sendPacket(spk);
activeChar.broadcastPacket(spk);
- ClientScheduler.getInstance().scheduleMed(new RunRace(codes, activeChar), 5000);
+ ClientScheduler.getInstance().scheduleOther(new RunRace(codes, activeChar), 5000);
}
}
@@ -151,7 +151,7 @@
MonRaceInfo spk = new MonRaceInfo(codes[2][0], codes[2][1], MonsterRace.getInstance().getMonsters(), MonsterRace.getInstance().getSpeeds());
activeChar.sendPacket(spk);
activeChar.broadcastPacket(spk);
- ClientScheduler.getInstance().scheduleMed(new RunEnd(activeChar), 30000);
+ ClientScheduler.getInstance().scheduleOther(new RunEnd(activeChar), 30000);
}
}
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTest.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTest.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTest.java (working copy)
@@ -70,10 +70,23 @@
if (command.equals("admin_stats"))
{
- for (String line : ClientScheduler.getInstance().getStats())
+
+ activeChar.sendMessage("Stats:");
+ activeChar.sendMessage("");
+ for (String line : ClientScheduler.getInstance().getStats())
{
activeChar.sendMessage(line);
}
+
+ activeChar.sendMessage("");
+ activeChar.sendMessage("Extended stats:");
+ activeChar.sendMessage("");
+
+ for (String line : ClientScheduler.getInstance().getExtendedStats())
+ {
+ activeChar.sendMessage(line);
+ }
+
}
else if (command.startsWith("admin_skill_test") || command.startsWith("admin_st"))
{
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/GameServer.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/GameServer.java (working copy)
@@ -204,7 +204,7 @@
throw new Exception("Could not initialize the ID factory");
}
- ClientScheduler.getInstance();
+ ClientScheduler.getInstance(); // we don't need singleton in this case but still would be nice to keep
new File(Config.DATAPACK_ROOT, "data/clans").mkdirs();
new File(Config.DATAPACK_ROOT, "data/crests").mkdirs();
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/idfactory/BitSetIDFactory.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/idfactory/BitSetIDFactory.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/idfactory/BitSetIDFactory.java (working copy)
@@ -69,7 +69,7 @@
protected BitSetIDFactory()
{
super();
- ClientScheduler.getInstance().scheduleAtFixedRate(new BitSetCapacityCheck(), TaskPriority.PR_LOW, 30000, 30000);
+ ClientScheduler.getInstance().scheduleSystemAtFixedRate(new BitSetCapacityCheck(), 30000, 30000);
initialize();
_log.info("IDFactory: "+ freeIds.size() + " id's avaliable.");
}
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ai/L2AttackableAI.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ai/L2AttackableAI.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ai/L2AttackableAI.java (working copy)
@@ -242,7 +242,7 @@
// If not idle - create an AI task (schedule onEvtThink repeatedly)
if (aiTask == null)
{
- aiTask = ClientScheduler.getInstance().scheduleLowAtFixedRate(this, 1000, 1000);
+ aiTask = ClientScheduler.getInstance().scheduleAiAtFixedRate(this, 1000, 1000);
}
}
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ai/L2SiegeGuardAI.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ai/L2SiegeGuardAI.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ai/L2SiegeGuardAI.java (working copy)
@@ -195,7 +195,7 @@
// If not idle - create an AI task (schedule onEvtThink repeatedly)
if (aiTask == null)
{
- aiTask = ClientScheduler.getInstance().scheduleLowAtFixedRate(this, 1000, 1000);
+ aiTask = ClientScheduler.getInstance().scheduleAiAtFixedRate(this, 1000, 1000);
}
}
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ai/AbstractAI.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ai/AbstractAI.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ai/AbstractAI.java (working copy)
@@ -740,7 +740,7 @@
// Create and Launch an AI Follow Task to execute every 1s
_follow_target = target;
- _follow_task = ClientScheduler.getInstance().scheduleMedAtFixedRate(new FollowTask(), 5, FOLLOW_INTERVAL);
+ _follow_task = ClientScheduler.getInstance().scheduleAiAtFixedRate(new FollowTask(), 5, FOLLOW_INTERVAL);
}
/**
@@ -758,7 +758,7 @@
}
_follow_target = target;
- _follow_task = ClientScheduler.getInstance().scheduleMedAtFixedRate(new FollowTask(range), 5, ATTACK_FOLLOW_INTERVAL);
+ _follow_task = ClientScheduler.getInstance().scheduleAiAtFixedRate(new FollowTask(range), 5, ATTACK_FOLLOW_INTERVAL);
}
/**
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/RecipeController.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/RecipeController.java (revision 1581)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/RecipeController.java (working copy)
@@ -524,7 +524,7 @@
manufacturer.isInCraftMode(true); // here we say craf mode started, no reason to do it sooner, just makes problems
- //ClientScheduler.scheduleCraftAction(this, 100);
+ //ClientScheduler.getInstance().scheduleCraft(this, 100);
run(); // for not-alternative crafting -> no reason why not craft immediately, cause it uses really little cpu
// and will never make lag ... scheduled things tend to make lag, things that are immediately done don't if you
// have sufficient cpu anyway ... how long can craft take ? few nanoseconds ?
@@ -633,7 +633,7 @@
manufacturer.isInCraftMode(false);
activeMakers.remove(manufacturer);
} else
- ClientScheduler.scheduleEvent(this, 1+delay); // Craft thread pool has nothing to do with other pools, so
+ ClientScheduler.getInstance().scheduleCraft(this, 1+delay); // Craft thread pool has nothing to do with other pools, so
// only way this can make any kind of lag is when CPU usage is 100%
// when nobody is "in craft mode" scheduled tasks for
// craft thread pool must be 0 or we have a bug again :/
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ClientScheduler.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ClientScheduler.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ClientScheduler.java (working copy)
@@ -1,3 +1,18 @@
+/*
+ * Temporary note:
+ * we need different types of thread pools:
+ *
+ * - system (all more important threads)
+ * - potions
+ * - buffs
+ * - ai
+ * - siege ai
+ * - craft
+ * - quest
+ * - other
+ *
+ */
+
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,20 +46,10 @@
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.clientpackets.ClientBasePacket;
-/**
- * This class permit to create 3 Threads pools and to add to it tasks to execute in function of their priority (HIGH, MEDIUM,LOW).<BR><BR>
- *
- * <B><U> Threads pools </U> :</B><BR><BR>
- * <li> A pool containing 4 Hight Threads </li>
- * <li> A pool containing 10 Medium Threads </li>
- * <li> A pool containing 4 Low priority Threads </li><BR><BR>
- *
- */
-
public final class ClientScheduler
{
- static Logger _log = Logger.getLogger(ClientScheduler.class.getName());
-
+ static Logger _log = Logger.getLogger(ClientScheduler.class.getName());
+
public static final int PRIORITY_URGENT = 3;
public static final int PRIORITY_HIGH = 2;
public static final int PRIORITY_MEDIUM = 1;
@@ -52,48 +57,89 @@
private static final ClientScheduler _instance = new ClientScheduler();
- private final ScheduledThreadPoolExecutor _executorHighPriority;
- private final ScheduledThreadPoolExecutor _executorMedPriority;
- private final ScheduledThreadPoolExecutor _executorLowPriority;
+ private final ScheduledThreadPoolExecutor _executorHigh; // system type threads, highest priority (not urgent)
+ private final ScheduledThreadPoolExecutor _executorMed; // only for "drinkable" type of potions
+ private final ScheduledThreadPoolExecutor _executorLow; // spells/buffs/melee skills with effect ???
+ private final ScheduledThreadPoolExecutor _executorSystem; // system type threads, highest priority (not urgent)
+ private final ScheduledThreadPoolExecutor _executorPotion; // only for "drinkable" type of potions
+ private final ScheduledThreadPoolExecutor _executorSkill; // spells/buffs/melee skills with effect ???
+ private final ScheduledThreadPoolExecutor _executorAi; // ai
+ private final ScheduledThreadPoolExecutor _executorSiegeAi; // think that Siege is important enough to have it's own pool
+ private final ScheduledThreadPoolExecutor _executorCraft; // threads used only in alt_craft_mode but wth
+ private final ScheduledThreadPoolExecutor _executorQuest; // quest related stuff ???
+ private final ScheduledThreadPoolExecutor _executorOther; // other ? what other ?
- /**
- * Constructor of ClientScheduler.<BR><BR>
- */
+
public static final ClientScheduler getInstance()
{
return _instance;
}
- /**
- * Create a pool of 4 Hight Threads, a pool of 10 Medium Threads, and a pool of 4 Low priority Threads to execute Task.<BR><BR>
- */
private ClientScheduler()
{
if (Config.ASSERT) assert _instance == null;
- _executorHighPriority = new ScheduledThreadPoolExecutor(Config.THREAD_P_HIGH, new ThrFactory(Config.EXECUTOR_PRI_HIGH, "PoolHIGH"));
- _executorMedPriority = new ScheduledThreadPoolExecutor(Config.THREAD_P_MED, new ThrFactory(Config.EXECUTOR_PRI_MED, "PoolMED"));
- _executorLowPriority = new ScheduledThreadPoolExecutor(Config.THREAD_P_LOW, new ThrFactory(Config.EXECUTOR_PRI_LOW, "PoolLOW"));
+ _executorHigh = new ScheduledThreadPoolExecutor(Config.THREAD_P_HIGH, new ThrFactory(Config.EXECUTOR_PRI_HIGH, "PoolHigh"));
+ _executorMed = new ScheduledThreadPoolExecutor(Config.THREAD_P_MED, new ThrFactory(Config.EXECUTOR_PRI_MED, "PoolMed"));
+ _executorLow = new ScheduledThreadPoolExecutor(Config.THREAD_P_LOW, new ThrFactory(Config.EXECUTOR_PRI_LOW, "PoolLow"));
+
+ _executorSystem = new ScheduledThreadPoolExecutor(Config.THREAD_P_SYSTEM, new ThrFactory(Config.EXECUTOR_PRI_SYSTEM, "PoolSystem"));
+ _executorPotion = new ScheduledThreadPoolExecutor(Config.THREAD_P_POTION, new ThrFactory(Config.EXECUTOR_PRI_POTION, "PoolPotion"));
+ _executorSkill = new ScheduledThreadPoolExecutor(Config.THREAD_P_SKILL, new ThrFactory(Config.EXECUTOR_PRI_SKILL, "PoolSkill"));
+ _executorAi = new ScheduledThreadPoolExecutor(Config.THREAD_P_AI, new ThrFactory(Config.EXECUTOR_PRI_AI, "PoolAi"));
+ _executorSiegeAi = new ScheduledThreadPoolExecutor(Config.THREAD_P_SIEGEAI, new ThrFactory(Config.EXECUTOR_PRI_SIEGEAI, "PoolSiegeAi"));
+ _executorCraft = new ScheduledThreadPoolExecutor(Config.THREAD_P_CRAFT, new ThrFactory(Config.EXECUTOR_PRI_CRAFT, "PoolCraft"));
+ _executorQuest = new ScheduledThreadPoolExecutor(Config.THREAD_P_QUEST, new ThrFactory(Config.EXECUTOR_PRI_QUEST, "PoolQuest"));
+ _executorOther = new ScheduledThreadPoolExecutor(Config.THREAD_P_OTHER, new ThrFactory(Config.EXECUTOR_PRI_OTHER, "PoolOther"));
}
- /**
- * Close all pool of Threads.<BR><BR>
- */
public void closeAll()
{
- try { _executorHighPriority.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
- try { _executorMedPriority.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
- try { _executorLowPriority.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
-
- try { _executorHighPriority.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
- try { _executorMedPriority.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
- try { _executorLowPriority.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ try { _executorHigh.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ try { _executorHigh.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ _executorHigh.shutdownNow();
+
+ try { _executorMed.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ try { _executorMed.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ _executorMed.shutdownNow();
+
+ try { _executorLow.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ try { _executorLow.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ _executorLow.shutdownNow();
- _executorHighPriority.shutdownNow();
- _executorHighPriority.shutdownNow();
- _executorHighPriority.shutdownNow();
+ try { _executorSystem.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ try { _executorSystem.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ _executorSystem.shutdownNow();
+
+ try { _executorPotion.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ try { _executorPotion.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ _executorPotion.shutdownNow();
+
+ try { _executorSkill.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ try { _executorSkill.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ _executorSkill.shutdownNow();
+
+ try { _executorAi.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ try { _executorAi.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ _executorAi.shutdownNow();
+
+ try { _executorSiegeAi.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ try { _executorSiegeAi.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ _executorSiegeAi.shutdownNow();
+
+ try { _executorCraft.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ try { _executorCraft.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ _executorCraft.shutdownNow();
+
+ try { _executorQuest.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ try { _executorQuest.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ _executorQuest.shutdownNow();
+
+ try { _executorOther.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ try { _executorOther.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); }
+ _executorOther.shutdownNow();
}
@@ -115,181 +161,224 @@
pkt.run();
return;
case PR_HIGH:
- _instance._executorHighPriority.execute(pkt);
+ _instance._executorHigh.execute(pkt);
return;
case PR_MEDIUM:
- _instance._executorMedPriority.execute(pkt);
+ _instance._executorMed.execute(pkt);
return;
case PR_LOW:
+ _instance._executorLow.execute(pkt);
+ return;
default:
- _instance._executorLowPriority.execute(pkt);
+ _instance._executorOther.execute(pkt);
return;
}
}
-
- /**
- * Create a task that is executed after an initial time (in ms) and each delay ms and define its priority.<BR><BR>
- *
- * <B><U> Example of use </U> :</B><BR><BR>
- * <li> Cubic Task</li><BR><BR>
- *
- * @param r The task to launch
- * @param TaskPriority The priority of the task
- * @param initial The initial delay (in ms) after what the task is executed for the first time
- * @param delay The delay (in ms) between 2 consecutive executions of the task
- *
- */
public ScheduledFuture scheduleAtFixedRate(Runnable r, TaskPriority pr, long initial, long delay)
{
switch (pr)
{
case PR_HIGH: return scheduleHighAtFixedRate(r, initial, delay);
case PR_MEDIUM: return scheduleMedAtFixedRate(r, initial, delay);
- default:
case PR_LOW: return scheduleLowAtFixedRate(r, initial, delay);
+ default: return scheduleOtherAtFixedRate(r, initial, delay);
+
}
}
-
- /**
- * Create a High priority task that is executed after an initial time (in ms) and each delay ms.<BR><BR>
- *
- * @param r The task to launch
- * @param initial The initial delay (in ms) after what the task is executed for the first time
- * @param delay The delay (in ms) between 2 consecutive executions of the task
- *
- */
public ScheduledFuture scheduleHighAtFixedRate(Runnable r, long initial, long delay)
{
try
{
if (delay < 0) delay = 0;
- return _executorHighPriority.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
+ return _executorHigh.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
}
-
-
- /**
- * Create a Medium priority task that is executed after an initial time (in ms) and each delay ms.<BR><BR>
- *
- * <B><U> Example of use </U> :</B><BR><BR>
- * <li> MP/HP Regeneration Task</li>
- * <li> Auto SoulShot</li><BR><BR>
- *
- * @param r The task to launch
- * @param initial The initial delay (in ms) after what the task is executed for the first time
- * @param delay The delay (in ms) between 2 consecutive executions of the task
- *
- */
public ScheduledFuture scheduleMedAtFixedRate(Runnable r, long initial, long delay)
{
try
{
if (delay < 0) delay = 0;
- return _executorMedPriority.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
+ return _executorMed.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
}
-
-
- /**
- * Create a Low priority task that is executed after an initial time (in ms) and each delay ms.<BR><BR>
- *
- * <B><U> Example of use </U> :</B><BR><BR>
- * <li> AI change intention</li>
- * <li> Game time controller</li>
- * <li> MP/HP Regeneration Task</li>
- * <li> Effect Task</li>
- * <li> Monster race</li><BR><BR>
- *
- * @param r The task to launch
- * @param initial The initial delay (in ms) after what the task is executed for the first time
- * @param delay The delay (in ms) between 2 consecutive executions of the task
- *
- */
public ScheduledFuture scheduleLowAtFixedRate(Runnable r, long initial, long delay)
{
try
{
if (delay < 0) delay = 0;
- return _executorLowPriority.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
+ return _executorLow.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
}
-
- /**
- * Create a task that is executed after an initial time (in ms) and define its priority.<BR><BR>
- *
- * @param r The task to launch
- * @param TaskPriority The priority of the task
- * @param initial The initial delay (in ms) after what the task is executed for the first time
- *
- */
+ public ScheduledFuture scheduleSystemAtFixedRate(Runnable r, long initial, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorSystem.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture schedulePotionAtFixedRate(Runnable r, long initial, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorPotion.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture scheduleSkillAtFixedRate(Runnable r, long initial, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorSkill.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture scheduleAiAtFixedRate(Runnable r, long initial, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorAi.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture scheduleSiegeAiAtFixedRate(Runnable r, long initial, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorSiegeAi.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture scheduleCraftAtFixedRate(Runnable r, long initial, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorCraft.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture scheduleQuestAtFixedRate(Runnable r, long initial, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorQuest.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture scheduleOtherAtFixedRate(Runnable r, long initial, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorOther.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+
public ScheduledFuture schedule(Runnable r, TaskPriority pr, long delay)
{
switch (pr)
{
case PR_HIGH: return scheduleHigh(r, delay);
case PR_MEDIUM: return scheduleMed(r, delay);
- default:
case PR_LOW: return scheduleLow(r, delay);
+ default: return scheduleOther(r, delay);
}
}
-
- /**
- * Create a High priority task that is executed after an initial time (in ms).<BR><BR>
- *
- * @param r The task to launch
- * @param initial The initial delay (in ms) after what the task is executed for the first time
- * @param delay The delay (in ms) between 2 consecutive executions of the task
- *
- */
public ScheduledFuture scheduleHigh(Runnable r, long delay)
{
try
{
if (delay < 0) delay = 0;
- return _executorHighPriority.schedule(r, delay, TimeUnit.MILLISECONDS);
+ return _executorHigh.schedule(r, delay, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
}
-
-
- /**
- * Create a Medium priority task that is executed after an initial time (in ms).<BR><BR>
- *
- * @param r The task to launch
- * @param initial The initial delay (in ms) after what the task is executed for the first time
- * @param delay The delay (in ms) between 2 consecutive executions of the task
- *
- */
public ScheduledFuture scheduleMed(Runnable r, long delay)
{
try
{
if (delay < 0) delay = 0;
- return _executorMedPriority.schedule(r, delay, TimeUnit.MILLISECONDS);
+ return _executorMed.schedule(r, delay, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
}
-
- /**
- * Create a Low priority task that is executed after an initial time (in ms).<BR><BR>
- *
- * @param r The task to launch
- * @param initial The initial delay (in ms) after what the task is executed for the first time
- * @param delay The delay (in ms) between 2 consecutive executions of the task
- *
- */
public ScheduledFuture scheduleLow(Runnable r, long delay)
{
try
{
if (delay < 0) delay = 0;
- return _executorLowPriority.schedule(r, delay, TimeUnit.MILLISECONDS);
+ return _executorLow.schedule(r, delay, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
}
+ public ScheduledFuture scheduleSystem(Runnable r, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorSystem.schedule(r, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture schedulePotion(Runnable r, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorPotion.schedule(r, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture scheduleSkill(Runnable r, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorSkill.schedule(r, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture scheduleAi(Runnable r, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorAi.schedule(r, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture scheduleSiegeAi(Runnable r, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorSiegeAi.schedule(r, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture scheduleCraft(Runnable r, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorCraft.schedule(r, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture scheduleQuest(Runnable r, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorQuest.schedule(r, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+ public ScheduledFuture scheduleOther(Runnable r, long delay)
+ {
+ try
+ {
+ if (delay < 0) delay = 0;
+ return _executorOther.schedule(r, delay, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ }
+ }
+
class ThrFactory implements ThreadFactory
{
private final String _prefix;
@@ -316,32 +405,80 @@
{
return new String[] {
"HIGH ("+Config.EXECUTOR_PRI_HIGH+")",
- "ActiveThreads: "+_executorHighPriority.getActiveCount(),
- "CompletedTasks: "+_executorHighPriority.getCompletedTaskCount(),
- "getCorePoolSize: "+_executorHighPriority.getCorePoolSize(),
- "MaximumPoolSize: "+_executorHighPriority.getMaximumPoolSize(),
- "LargestPoolSize: "+_executorHighPriority.getLargestPoolSize(),
- "PoolSize: "+_executorHighPriority.getPoolSize(),
- "ScheduledTasks: "+(_executorHighPriority.getTaskCount() - _executorHighPriority.getCompletedTaskCount()),
+ "ActiveThreads: "+_executorHigh.getActiveCount(),
+ "CompletedTasks: "+_executorHigh.getCompletedTaskCount(),
+ "getCorePoolSize: "+_executorHigh.getCorePoolSize(),
+ "PoolSize: "+_executorHigh.getPoolSize(),
+ "ScheduledTasks: "+(_executorHigh.getTaskCount() - _executorHigh.getCompletedTaskCount()),
"MEDIUM ("+Config.EXECUTOR_PRI_MED+")",
- "ActiveThreads: "+_executorMedPriority.getActiveCount(),
- "CompletedTasks: "+_executorMedPriority.getCompletedTaskCount(),
- "getCorePoolSize: "+_executorMedPriority.getCorePoolSize(),
- "MaximumPoolSize: "+_executorMedPriority.getMaximumPoolSize(),
- "LargestPoolSize: "+_executorMedPriority.getLargestPoolSize(),
- "PoolSize: "+_executorMedPriority.getPoolSize(),
- "ScheduledTasks: "+(_executorMedPriority.getTaskCount() - _executorMedPriority.getCompletedTaskCount()),
+ "ActiveThreads: "+_executorMed.getActiveCount(),
+ "CompletedTasks: "+_executorMed.getCompletedTaskCount(),
+ "getCorePoolSize: "+_executorMed.getCorePoolSize(),
+ "PoolSize: "+_executorMed.getPoolSize(),
+ "ScheduledTasks: "+(_executorMed.getTaskCount() - _executorMed.getCompletedTaskCount()),
"LOW ("+Config.EXECUTOR_PRI_LOW+")",
- "ActiveThreads: "+_executorLowPriority.getActiveCount(),
- "CompletedTasks: "+_executorLowPriority.getCompletedTaskCount(),
- "getCorePoolSize: "+_executorLowPriority.getCorePoolSize(),
- "MaximumPoolSize: "+_executorLowPriority.getMaximumPoolSize(),
- "LargestPoolSize: "+_executorLowPriority.getLargestPoolSize(),
- "PoolSize: "+_executorLowPriority.getPoolSize(),
- "ScheduledTasks: "+(_executorLowPriority.getTaskCount() - _executorLowPriority.getCompletedTaskCount())
+ "ActiveThreads: "+_executorLow.getActiveCount(),
+ "CompletedTasks: "+_executorLow.getCompletedTaskCount(),
+ "getCorePoolSize: "+_executorLow.getCorePoolSize(),
+ "PoolSize: "+_executorLow.getPoolSize(),
+ "ScheduledTasks: "+(_executorLow.getTaskCount() - _executorLow.getCompletedTaskCount())
};
}
+ public String[] getExtendedStats()
+ {
+ return new String[] {
+ "SYSTEM ("+Config.EXECUTOR_PRI_SYSTEM+")",
+ "ActiveThreads: "+_executorSystem.getActiveCount(),
+ "CompletedTasks: "+_executorSystem.getCompletedTaskCount(),
+ "getCorePoolSize: "+_executorSystem.getCorePoolSize(),
+ "PoolSize: "+_executorSystem.getPoolSize(),
+ "ScheduledTasks: "+(_executorSystem.getTaskCount() - _executorSystem.getCompletedTaskCount()),
+ "POTION ("+Config.EXECUTOR_PRI_POTION+")",
+ "ActiveThreads: "+_executorPotion.getActiveCount(),
+ "CompletedTasks: "+_executorPotion.getCompletedTaskCount(),
+ "getCorePoolSize: "+_executorPotion.getCorePoolSize(),
+ "PoolSize: "+_executorPotion.getPoolSize(),
+ "ScheduledTasks: "+(_executorPotion.getTaskCount() - _executorPotion.getCompletedTaskCount()),
+ "SKILL ("+Config.EXECUTOR_PRI_SKILL+")",
+ "ActiveThreads: "+_executorSkill.getActiveCount(),
+ "CompletedTasks: "+_executorSkill.getCompletedTaskCount(),
+ "getCorePoolSize: "+_executorSkill.getCorePoolSize(),
+ "PoolSize: "+_executorSkill.getPoolSize(),
+ "ScheduledTasks: "+(_executorSkill.getTaskCount() - _executorSkill.getCompletedTaskCount()),
+ "AI ("+Config.EXECUTOR_PRI_AI+")",
+ "ActiveThreads: "+_executorAi.getActiveCount(),
+ "CompletedTasks: "+_executorAi.getCompletedTaskCount(),
+ "getCorePoolSize: "+_executorAi.getCorePoolSize(),
+ "PoolSize: "+_executorAi.getPoolSize(),
+ "ScheduledTasks: "+(_executorAi.getTaskCount() - _executorAi.getCompletedTaskCount()),
+ "SIEGEAI ("+Config.EXECUTOR_PRI_SIEGEAI+")",
+ "ActiveThreads: "+_executorSiegeAi.getActiveCount(),
+ "CompletedTasks: "+_executorSiegeAi.getCompletedTaskCount(),
+ "getCorePoolSize: "+_executorSiegeAi.getCorePoolSize(),
+ "PoolSize: "+_executorSiegeAi.getPoolSize(),
+ "ScheduledTasks: "+(_executorSiegeAi.getTaskCount() - _executorSiegeAi.getCompletedTaskCount()),
+ "CRAFT ("+Config.EXECUTOR_PRI_CRAFT+")",
+ "ActiveThreads: "+_executorCraft.getActiveCount(),
+ "CompletedTasks: "+_executorCraft.getCompletedTaskCount(),
+ "getCorePoolSize: "+_executorCraft.getCorePoolSize(),
+ "PoolSize: "+_executorCraft.getPoolSize(),
+ "ScheduledTasks: "+(_executorCraft.getTaskCount() - _executorCraft.getCompletedTaskCount()),
+ "QUEST ("+Config.EXECUTOR_PRI_QUEST+")",
+ "ActiveThreads: "+_executorQuest.getActiveCount(),
+ "CompletedTasks: "+_executorQuest.getCompletedTaskCount(),
+ "getCorePoolSize: "+_executorQuest.getCorePoolSize(),
+ "PoolSize: "+_executorQuest.getPoolSize(),
+ "ScheduledTasks: "+(_executorQuest.getTaskCount() - _executorQuest.getCompletedTaskCount()),
+ "OTHER ("+Config.EXECUTOR_PRI_OTHER+")",
+ "ActiveThreads: "+_executorOther.getActiveCount(),
+ "CompletedTasks: "+_executorOther.getCompletedTaskCount(),
+ "getCorePoolSize: "+_executorOther.getCorePoolSize(),
+ "PoolSize: "+_executorOther.getPoolSize(),
+ "ScheduledTasks: "+(_executorOther.getTaskCount() - _executorOther.getCompletedTaskCount())
+ };
+ }
+
public static ScheduledFuture scheduleEvent(Runnable event, long delay)
{
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/taskmanager/DecayTaskManager.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/taskmanager/DecayTaskManager.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/taskmanager/DecayTaskManager.java (working copy)
@@ -24,7 +24,7 @@
public DecayTaskManager()
{
- ClientScheduler.getInstance().scheduleMedAtFixedRate(new DecayScheduler(),10000,5000);
+ ClientScheduler.getInstance().scheduleOtherAtFixedRate(new DecayScheduler(),10000,5000);
}
public static DecayTaskManager getInstance()
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/taskmanager/tasks/TaskCleanUp.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/taskmanager/tasks/TaskCleanUp.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/taskmanager/tasks/TaskCleanUp.java (working copy)
@@ -23,8 +23,8 @@
public void onTimeElapsed(ExecutedTask task)
{
- System.runFinalization();
- System.gc();
+// System.runFinalization();
+// System.gc();
}
public void initializate()
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/SevenSigns.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/SevenSigns.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/SevenSigns.java (working copy)
@@ -340,7 +340,7 @@
// Schedule a time for the next period change.
SevenSignsPeriodChange sspc = new SevenSignsPeriodChange();
- ClientScheduler.getInstance().scheduleMed(sspc, milliToChange);
+ ClientScheduler.getInstance().scheduleOther(sspc, milliToChange);
// Thanks to http://rainbow.arch.scriptmania.com/scripts/timezone_countdown.html for help with this.
double numSecs = (milliToChange / 1000) % 60;
@@ -1460,7 +1460,7 @@
setCalendarForNextPeriodChange();
SevenSignsPeriodChange sspc = new SevenSignsPeriodChange();
- ClientScheduler.getInstance().scheduleMed(sspc, getMilliToPeriodChange());
+ ClientScheduler.getInstance().scheduleOther(sspc, getMilliToPeriodChange());
}
}
}
\ No newline at end of file
Index: C:/workspace/C4-Alpha/java/net/sf/l2j/L2DatabaseFactory.java
===================================================================
--- C:/workspace/C4-Alpha/java/net/sf/l2j/L2DatabaseFactory.java (revision 1580)
+++ C:/workspace/C4-Alpha/java/net/sf/l2j/L2DatabaseFactory.java (working copy)
@@ -63,8 +63,11 @@
config.setMinPoolSize(1);
config.setMaxPoolSize(Config.DATABASE_MAX_CONNECTIONS);
config.setMaxStatements(100);
- config.setIdleConnectionTestPeriod(0); // test idle connection every 1 minute
- config.setMaxIdleTime(0); // remove unused connection after 10 minutes
+ config.setIdleConnectionTestPeriod(60); // test idle connection every 1 minute
+ config.setMaxIdleTime(60); // remove unused connection after 10 minutes
+ config.setNumHelperThreads(5);
+ config.setTestConnectionOnCheckin(true);
+ config.setTestConnectionOnCheckout(true);
Class.forName(Config.DATABASE_DRIVER).newInstance();
Index: C:/workspace/C4-Alpha/.project
===================================================================
--- C:/workspace/C4-Alpha/.project (revision 1580)
+++ C:/workspace/C4-Alpha/.project (working copy)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>L2_GameServer_c4</name>
+ <name>C4-Alpha</name>
<comment></comment>
<projects>
<project>L2_Logging</project>
@@ -15,4 +15,11 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
+ <linkedResources>
+ <link>
+ <name>classes</name>
+ <type>2</type>
+ <location>C:/workspace/C4-Alpha/build/classes</location>
+ </link>
+ </linkedResources>
</projectDescription>
Index: C:/workspace/C4-Alpha/build.xml
===================================================================
--- C:/workspace/C4-Alpha/build.xml (revision 1580)
+++ C:/workspace/C4-Alpha/build.xml (working copy)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project name="L2_GameServer" default="dist" basedir=".">
+<project name="c4_alpha" default="dist" basedir=".">
<description>
This script will build the L2J server.
Index: C:/workspace/C4-Alpha/.classpath
===================================================================
--- C:/workspace/C4-Alpha/.classpath (revision 1580)
+++ C:/workspace/C4-Alpha/.classpath (working copy)
@@ -1,24 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="java"/>
- <classpathentry kind="src" path="javaTest"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.0.0/src/org.junit_3.8.1/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
- <classpathentry kind="lib" path="lib/bsf.jar"/>
- <classpathentry kind="lib" path="lib/bsh-2.0.jar"/>
- <classpathentry kind="lib" path="lib/jython.jar"/>
- <classpathentry kind="lib" path="lib/c3p0-0.9.0.jar"/>
- <classpathentry kind="lib" path="lib/mysql-connector-java-3.1.10-bin.jar"/>
- <classpathentry kind="lib" path="lib/javolution.jar"/>
- <classpathentry kind="lib" path="lib/sqljdbc.jar"/>
- <classpathentry kind="lib" path="lib/commons-collections-2.1.1.jar"/>
- <classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
- <classpathentry kind="lib" path="lib/hibernate3.jar"/>
- <classpathentry kind="lib" path="lib/log4j-1.2.11.jar"/>
- <classpathentry kind="lib" path="lib/asm.jar"/>
- <classpathentry kind="lib" path="lib/asm-attrs.jar"/>
- <classpathentry kind="lib" path="lib/cglib-2.1.3.jar"/>
- <classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
- <classpathentry kind="lib" path="lib/jta.jar"/>
+ <classpathentry output="classes" kind="src" path="java"/>
+ <classpathentry sourcepath="JRE_SRC" kind="var" rootpath="JRE_SRCROOT" path="JRE_LIB"/>
+ <classpathentry kind="lib" path="C:/workspace/C4-Alpha/lib/bsf.jar"/>
+ <classpathentry kind="lib" path="C:/workspace/C4-Alpha/lib/bsh-2.0.jar"/>
+ <classpathentry kind="lib" path="C:/workspace/C4-Alpha/lib/c3p0-0.9.0.jar"/>
+ <classpathentry kind="lib" path="C:/workspace/C4-Alpha/lib/hibernate3.jar"/>
+ <classpathentry kind="lib" path="C:/workspace/C4-Alpha/lib/javolution.jar"/>
+ <classpathentry kind="lib" path="C:/workspace/C4-Alpha/lib/jython.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>