Index: 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,20 @@ 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_TASK; + public static int THREAD_P_SPAWN; + public static int THREAD_P_POTION; + public static int THREAD_P_EFFECT; + public static int THREAD_P_AI; + public static int THREAD_P_SIEGEAI; + public static int THREAD_P_SIEGE; + public static int THREAD_P_ACTOR; + 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 +422,20 @@ public static int EXECUTOR_PRI_MED; public static int EXECUTOR_PRI_HIGH; + public static int EXECUTOR_PRI_SYSTEM; + public static int EXECUTOR_PRI_TASK; + public static int EXECUTOR_PRI_SPAWN; + public static int EXECUTOR_PRI_POTION; + public static int EXECUTOR_PRI_EFFECT; + public static int EXECUTOR_PRI_AI; + public static int EXECUTOR_PRI_SIEGEAI; + public static int EXECUTOR_PRI_SIEGE; + public static int EXECUTOR_PRI_ACTOR; + 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 +660,19 @@ 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_TASK = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeTask", "4")); + THREAD_P_SPAWN = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeSpawn", "4")); + THREAD_P_POTION = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizePotion", "4")); + THREAD_P_EFFECT = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeEffect", "4")); + THREAD_P_AI = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeAi", "4")); + THREAD_P_SIEGEAI = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeSiegeAi", "4")); + THREAD_P_SIEGE = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeSiege", "4")); + THREAD_P_ACTOR = Integer.parseInt(serverSettings.getProperty("ThreadPoolSizeActor", "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 +706,21 @@ 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_TASK = Integer.parseInt(serverSettings.getProperty("ExecutorPriTask", "0")); + EXECUTOR_PRI_SPAWN = Integer.parseInt(serverSettings.getProperty("ExecutorPriSpawn", "0")); + EXECUTOR_PRI_POTION = Integer.parseInt(serverSettings.getProperty("ExecutorPriPotion", "-1")); + EXECUTOR_PRI_EFFECT = Integer.parseInt(serverSettings.getProperty("ExecutorPriEffect", "-1")); + EXECUTOR_PRI_AI = Integer.parseInt(serverSettings.getProperty("ExecutorPriAi", "0")); + EXECUTOR_PRI_SIEGEAI = Integer.parseInt(serverSettings.getProperty("ExecutorPriSiegeAi", "0")); + EXECUTOR_PRI_SIEGE = Integer.parseInt(serverSettings.getProperty("ExecutorPriSiege", "0")); + EXECUTOR_PRI_ACTOR = Integer.parseInt(serverSettings.getProperty("ExecutorPriActor", "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", "-1")); + 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/ClientThread.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ClientThread.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/ClientThread.java (working copy) @@ -95,7 +95,7 @@ { _sessionId = 0x12345678; _connection = new Connection(this, socket, _cryptkey); - _autoSaveInDB = ClientScheduler.getInstance().scheduleLowAtFixedRate( + _autoSaveInDB = ClientScheduler.getInstance().scheduleOtherAtFixedRate( new AutoSaveTask(), 5*60*1000L, 15*60*1000L ); } Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/SelectorThread.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/SelectorThread.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/SelectorThread.java (working copy) @@ -140,7 +140,7 @@ if (Config.ASSERT) assert instance == null; if (Config.COUNT_PACKETS) { - packetMonitor = ClientScheduler.getInstance().scheduleLowAtFixedRate(new MonitorPackets(), 10000, 10000); + packetMonitor = ClientScheduler.getInstance().scheduleOtherAtFixedRate(new MonitorPackets(), 10000, 10000); } instance = this; this._hostname = hostname; @@ -685,7 +685,7 @@ if(GameTimeController.getGameTicks() - player.getAttackEndTime() < 15 * GameTimeController.TICKS_PER_SECOND || player.isAttacked()) { c.onlyClose(); - ClientScheduler.getInstance().scheduleLow(new DisconnectionTask(c), 15000); + ClientScheduler.getInstance().scheduleOther(new DisconnectionTask(c), 15000); return; } } @@ -734,7 +734,7 @@ packetHistory.clear(); byteHistory.clear(); - packetMonitor = ClientScheduler.getInstance().scheduleLowAtFixedRate( + packetMonitor = ClientScheduler.getInstance().scheduleOtherAtFixedRate( new Runnable() { public void run() Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/clientpackets/RequestWearItem.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/clientpackets/RequestWearItem.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/clientpackets/RequestWearItem.java (working copy) @@ -219,7 +219,7 @@ sendPacket(il); if (_removeWearItemsTask == null) - _removeWearItemsTask=ClientScheduler.getInstance().scheduleLow(new RemoveWearItemsTask(), 10000); + _removeWearItemsTask=ClientScheduler.getInstance().scheduleOther(new RemoveWearItemsTask(), 10000); } /* (non-Javadoc) 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/model/actor/instance/L2BoatInstance.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2BoatInstance.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2BoatInstance.java (working copy) @@ -321,17 +321,17 @@ case 1: _boat.say(5); bc = new BoatCaptain(2,_boat); - ClientScheduler.getInstance().scheduleLow(bc, 240000); + ClientScheduler.getInstance().scheduleActor(bc, 240000); break; case 2: _boat.say(1); bc = new BoatCaptain(3,_boat); - ClientScheduler.getInstance().scheduleLow(bc, 40000); + ClientScheduler.getInstance().scheduleActor(bc, 40000); break; case 3: _boat.say(0); bc = new BoatCaptain(4,_boat); - ClientScheduler.getInstance().scheduleLow(bc, 20000); + ClientScheduler.getInstance().scheduleActor(bc, 20000); break; case 4: _boat.say(-1); @@ -365,7 +365,7 @@ { _state++; Boatrun bc = new Boatrun(_state,_boat); - ClientScheduler.getInstance().scheduleLow(bc, time); + ClientScheduler.getInstance().scheduleActor(bc, time); } else if(time == 0) @@ -373,7 +373,7 @@ _boat._cycle = 2; _boat.say(10); BoatCaptain bc = new BoatCaptain(1,_boat); - ClientScheduler.getInstance().scheduleLow(bc, 300000); + ClientScheduler.getInstance().scheduleActor(bc, 300000); } else { @@ -389,14 +389,14 @@ { _state++; Boatrun bc = new Boatrun(_state,_boat); - ClientScheduler.getInstance().scheduleLow(bc, time); + ClientScheduler.getInstance().scheduleActor(bc, time); } else if(time == 0) { _boat._cycle = 1; _boat.say(10); BoatCaptain bc = new BoatCaptain(1,_boat); - ClientScheduler.getInstance().scheduleLow(bc, 300000); + ClientScheduler.getInstance().scheduleActor(bc, 300000); } else { @@ -422,7 +422,7 @@ { //_runstate++; Boatrun bc = new Boatrun(_runstate,this); - ClientScheduler.getInstance().scheduleLow(bc, 10); + ClientScheduler.getInstance().scheduleActor(bc, 10); _runstate = 0; } } @@ -444,7 +444,7 @@ { say(10); BoatCaptain bc = new BoatCaptain(1,this); - ClientScheduler.getInstance().scheduleLow(bc, 300000); + ClientScheduler.getInstance().scheduleActor(bc, 300000); } /** * @param destination @@ -532,7 +532,7 @@ } } Boatrun bc = new Boatrun(0,this); - ClientScheduler.getInstance().scheduleLow(bc, 0); + ClientScheduler.getInstance().scheduleActor(bc, 0); } else if(_cycle == 2) { @@ -568,7 +568,7 @@ } Boatrun bc = new Boatrun(0,this); - ClientScheduler.getInstance().scheduleLow(bc, 0); + ClientScheduler.getInstance().scheduleActor(bc, 0); } } Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2CubicInstance.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2CubicInstance.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2CubicInstance.java (working copy) @@ -65,7 +65,7 @@ _owner = owner; _id = id; _level = level; - _disappearTask = ClientScheduler.getInstance().scheduleLow(new Disappear(), 1200000); // disappear in 20 mins + _disappearTask = ClientScheduler.getInstance().scheduleActor(new Disappear(), 1200000); // disappear in 20 mins switch(_id) { Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2GuardInstance.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2GuardInstance.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2GuardInstance.java (working copy) @@ -75,7 +75,7 @@ super.setKnownList(new GuardKnownList(new L2GuardInstance[] {this})); Random rnd = new Random(); - ClientScheduler.getInstance().scheduleLowAtFixedRate(new ReturnTask(),RETURN_INTERVAL,RETURN_INTERVAL+rnd.nextInt(60000)); + ClientScheduler.getInstance().scheduleActorAtFixedRate(new ReturnTask(),RETURN_INTERVAL,RETURN_INTERVAL+rnd.nextInt(60000)); } public final GuardKnownList getKnownList() { return (GuardKnownList)super.getKnownList(); } Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2DoorInstance.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2DoorInstance.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2DoorInstance.java (working copy) @@ -210,7 +210,7 @@ if (actionDelay > -1) { AutoOpenClose ao = new AutoOpenClose(); - ClientScheduler.getInstance().scheduleLowAtFixedRate(ao, actionDelay, actionDelay); + ClientScheduler.getInstance().scheduleActorAtFixedRate(ao, actionDelay, actionDelay); } else { if (_autoActionTask != null) @@ -417,7 +417,7 @@ public void onOpen() { - ClientScheduler.getInstance().scheduleLow(new CloseTask(), 60000); + ClientScheduler.getInstance().scheduleActor(new CloseTask(), 60000); } public void onClose() Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2XmassTreeInstance.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2XmassTreeInstance.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2XmassTreeInstance.java (working copy) @@ -62,7 +62,7 @@ public L2XmassTreeInstance(int objectId, L2NpcTemplate template) { super(objectId, template); - aiTask = ClientScheduler.getInstance().scheduleLowAtFixedRate(new XmassAI(this), 3000, 3000); + aiTask = ClientScheduler.getInstance().scheduleActorAtFixedRate(new XmassAI(this), 3000, 3000); } public void deleteMe() Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2SummonInstance.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2SummonInstance.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2SummonInstance.java (working copy) @@ -39,7 +39,7 @@ { super(objectId, template, owner); setShowSummonAnimation(true); - _disappearTask = ClientScheduler.getInstance().scheduleLow(new Disappear(getOwner(), this), 1200000); // disappear in 20 mins + _disappearTask = ClientScheduler.getInstance().scheduleActor(new Disappear(getOwner(), this), 1200000); // disappear in 20 mins } public final int getLevel() { Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java (working copy) @@ -796,7 +796,7 @@ if(rnd.nextInt(100)(); ClientScheduler s = ClientScheduler.getInstance(); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_AVAILABLE_FOR_S1_RACE), 0, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_NOW_AVAILABLE_FOR_S1_RACE), 30 * SECOND, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_AVAILABLE_FOR_S1_RACE), MINUTE, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_NOW_AVAILABLE_FOR_S1_RACE), MINUTE + 30 * SECOND, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_STOP_IN_S1_MINUTES), 2 * MINUTE, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_STOP_IN_S1_MINUTES), 3 * MINUTE, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_STOP_IN_S1_MINUTES), 4 * MINUTE, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_STOP_IN_S1_MINUTES), 5 * MINUTE, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_STOP_IN_S1_MINUTES), 6 * MINUTE, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKET_SALES_CLOSED), 7 * MINUTE, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_MINUTES), 7 * MINUTE, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_MINUTES), 8 * MINUTE, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_30_SECONDS), 8 * MINUTE + 30 * SECOND, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_COUNTDOWN_IN_FIVE_SECONDS), 8 * MINUTE + 50 * SECOND, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_SECONDS), 8 * MINUTE + 55 * SECOND, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_SECONDS), 8 * MINUTE + 56 * SECOND, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_SECONDS), 8 * MINUTE + 57 * SECOND, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_SECONDS), 8 * MINUTE + 58 * SECOND, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_SECONDS), 8 * MINUTE + 59 * SECOND, 10 * MINUTE); - s.scheduleLowAtFixedRate(new Announcement(SystemMessage.MONSRACE_RACE_START), 9 * MINUTE, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_AVAILABLE_FOR_S1_RACE), 0, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_NOW_AVAILABLE_FOR_S1_RACE), 30 * SECOND, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_AVAILABLE_FOR_S1_RACE), MINUTE, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_NOW_AVAILABLE_FOR_S1_RACE), MINUTE + 30 * SECOND, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_STOP_IN_S1_MINUTES), 2 * MINUTE, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_STOP_IN_S1_MINUTES), 3 * MINUTE, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_STOP_IN_S1_MINUTES), 4 * MINUTE, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_STOP_IN_S1_MINUTES), 5 * MINUTE, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKETS_STOP_IN_S1_MINUTES), 6 * MINUTE, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_TICKET_SALES_CLOSED), 7 * MINUTE, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_MINUTES), 7 * MINUTE, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_MINUTES), 8 * MINUTE, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_30_SECONDS), 8 * MINUTE + 30 * SECOND, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_COUNTDOWN_IN_FIVE_SECONDS), 8 * MINUTE + 50 * SECOND, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_SECONDS), 8 * MINUTE + 55 * SECOND, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_SECONDS), 8 * MINUTE + 56 * SECOND, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_SECONDS), 8 * MINUTE + 57 * SECOND, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_SECONDS), 8 * MINUTE + 58 * SECOND, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_BEGINS_IN_S1_SECONDS), 8 * MINUTE + 59 * SECOND, 10 * MINUTE); + s.scheduleActorAtFixedRate(new Announcement(SystemMessage.MONSRACE_RACE_START), 9 * MINUTE, 10 * MINUTE); //*/ } managers.add(this); Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/quest/QuestTimer.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/quest/QuestTimer.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/quest/QuestTimer.java (working copy) @@ -36,7 +36,7 @@ { _Name = name; _QuestState = qs; - _Schedular = ClientScheduler.getInstance().scheduleLow(new ScheduleTimerTask(), time); // Prepare auto end task + _Schedular = ClientScheduler.getInstance().scheduleQuest(new ScheduleTimerTask(), time); // Prepare auto end task } // ========================================================= Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/quest/QuestPcSpawnManager.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/quest/QuestPcSpawnManager.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/quest/QuestPcSpawnManager.java (working copy) @@ -19,7 +19,7 @@ try { cleanUp(); - ClientScheduler.getInstance().scheduleLow(new ScheduleTimerTask(), 60000); + ClientScheduler.getInstance().scheduleQuest(new ScheduleTimerTask(), 60000); } catch (Throwable t){} } } @@ -33,7 +33,7 @@ // Constructor public QuestPcSpawnManager() { - ClientScheduler.getInstance().scheduleLow(new ScheduleTimerTask(), 60000); + ClientScheduler.getInstance().scheduleQuest(new ScheduleTimerTask(), 60000); } // ========================================================= Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/quest/QuestPcSpawn.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/quest/QuestPcSpawn.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/quest/QuestPcSpawn.java (working copy) @@ -335,7 +335,7 @@ private void addDeSpawnTask(int objectId, int spawnLength) { if (spawnLength > 0) - ClientScheduler.getInstance().scheduleLow(new DeSpawnScheduleTimerTask(objectId), spawnLength); + ClientScheduler.getInstance().scheduleQuest(new DeSpawnScheduleTimerTask(objectId), spawnLength); } // ========================================================= Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/quest/QuestStateManager.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/quest/QuestStateManager.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/quest/QuestStateManager.java (working copy) @@ -19,7 +19,7 @@ try { cleanUp(); - ClientScheduler.getInstance().scheduleLow(new ScheduleTimerTask(), 60000); + ClientScheduler.getInstance().scheduleQuest(new ScheduleTimerTask(), 60000); } catch (Throwable t){} } } @@ -33,7 +33,7 @@ // Constructor public QuestStateManager() { - ClientScheduler.getInstance().scheduleLow(new ScheduleTimerTask(), 60000); + ClientScheduler.getInstance().scheduleQuest(new ScheduleTimerTask(), 60000); } // ========================================================= Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/L2Effect.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/L2Effect.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/L2Effect.java (working copy) @@ -187,7 +187,7 @@ int duration = _period - _periodfirsttime; //_log.warning("Period: "+_period+"-"+_periodfirsttime+"="+duration); _currentTask = new EffectTask(duration * 1000, -1); - _currentFuture = ClientScheduler.getInstance().scheduleLow( + _currentFuture = ClientScheduler.getInstance().scheduleEffect( _currentTask, duration * 1000 ); } } @@ -248,7 +248,7 @@ { stopEffectTask(); _currentTask = new EffectTask(duration, -1); - _currentFuture = ClientScheduler.getInstance().scheduleLow( + _currentFuture = ClientScheduler.getInstance().scheduleEffect( _currentTask, duration); if (_state == EffectState.ACTING) _effected.addEffect(this); @@ -259,7 +259,7 @@ { stopEffectTask(); _currentTask = new EffectTask(delay, rate); - _currentFuture = ClientScheduler.getInstance().scheduleLowAtFixedRate( + _currentFuture = ClientScheduler.getInstance().scheduleEffectAtFixedRate( _currentTask, delay, rate); if (_state == EffectState.ACTING) _effected.addEffect(this); Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/AutoChatHandler.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/AutoChatHandler.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/AutoChatHandler.java (working copy) @@ -483,7 +483,7 @@ if (isActive()) { AutoChatRunner acr = new AutoChatRunner(_npcId, -1); - _chatTask = ClientScheduler.getInstance().scheduleLowAtFixedRate(acr, _defaultDelay, _defaultDelay); + _chatTask = ClientScheduler.getInstance().scheduleOtherAtFixedRate(acr, _defaultDelay, _defaultDelay); } else { _chatTask.cancel(false); @@ -585,7 +585,7 @@ if (activeValue) { AutoChatRunner acr = new AutoChatRunner(_npcId, _npcInstance.getObjectId()); - _chatTask = ClientScheduler.getInstance().scheduleLowAtFixedRate(acr, getChatDelay(), getChatDelay()); + _chatTask = ClientScheduler.getInstance().scheduleOtherAtFixedRate(acr, getChatDelay(), getChatDelay()); } else { _chatTask.cancel(false); Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/L2Skill.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/L2Skill.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/L2Skill.java (working copy) @@ -1320,6 +1320,72 @@ return targetList.toArray(new L2Object[targetList.size()]); } } + case TARGET_AREA_CORPSE_MOB: + { + L2PcInstance player = null; + player = (L2PcInstance)activeChar; + player.sendMessage("Target area corpse mob"); + if(!(target instanceof L2Attackable) || !target.isDead()) + { + activeChar.sendPacket(new SystemMessage(SystemMessage.TARGET_IS_INCORRECT)); + return null; + } + L2Character cha; + cha = target; + + boolean skillUserIsL2PcInstance = (activeChar instanceof L2PcInstance); + boolean effectOriginIsL2PcInstance = (cha instanceof L2PcInstance); + boolean objIsL2PcInstance; + int radius = getSkillRadius(); + for (L2Object obj : cha.getKnownList().getKnownObjects()) + { + if (!(obj instanceof L2Character)) continue; + + target = (L2Character) obj; + if(!target.isAlikeDead() && target != activeChar) // If target is not dead/fake death and not self + { + if (!Util.checkIfInRange(radius, cha, obj, true)) // Go to next obj if obj isn't in range + continue; + + objIsL2PcInstance = (obj instanceof L2PcInstance); + + if (skillUserIsL2PcInstance) // Skill attacker is L2PcInstance, hit everything except + { + if ( + ( // ( + objIsL2PcInstance && // obj is L2PcInstance and + ( // ( + ( // In same clan + (((L2PcInstance)activeChar).getClan() != null && ((L2PcInstance)obj).getClan() != null) && + ((L2PcInstance)activeChar).getClan().getClanId() == ((L2PcInstance)obj).getClan().getClanId() + ) || // or in same party + ( + (((L2PcInstance)activeChar).getParty() != null && ((L2PcInstance)obj).getParty() != null) && + ((L2PcInstance)activeChar).getParty().getPartyLeaderOID() == ((L2PcInstance)obj).getParty().getPartyLeaderOID() + ) || // or not pvp with + !((L2PcInstance)activeChar).checkPvpSkill(obj, this) + ) // ) + ) + ) + continue; + } + else // Skill user is not L2PcInstance + { + if (effectOriginIsL2PcInstance && // If effect starts at L2PcInstance and + !objIsL2PcInstance) // Object is not L2PcInstance + continue; + } + + targetList.add((L2Character)obj); // Add obj to target lists + } + } + System.out.println("Amount of targets: "+targetList.size()); + player.sendMessage("Targets: "+targetList.size()); + if (targetList.size() == 0) + return null; + + return targetList.toArray(new L2Character[targetList.size()]); + } default: { SystemMessage sm = new SystemMessage(614); Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/AutoSpawnHandler.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/AutoSpawnHandler.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/AutoSpawnHandler.java (working copy) @@ -255,7 +255,7 @@ if (isActive) { AutoSpawner rs = new AutoSpawner(objectId); - spawnTask = ClientScheduler.getInstance().scheduleLowAtFixedRate(rs, spawnInst._initDelay, spawnInst._resDelay); + spawnTask = ClientScheduler.getInstance().scheduleSpawnAtFixedRate(rs, spawnInst._initDelay, spawnInst._resDelay); _runningSpawns.put(objectId, spawnTask); } else { @@ -448,7 +448,7 @@ // If there is no despawn time, do not create a despawn task. if (spawnInst.getDespawnDelay() > 0) { AutoDespawner rd = new AutoDespawner(_objectId); - ClientScheduler.getInstance().scheduleLow(rd, spawnInst.getDespawnDelay()-1000); + ClientScheduler.getInstance().scheduleSpawn(rd, spawnInst.getDespawnDelay()-1000); } } catch (Exception e) { Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/L2Spawn.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/L2Spawn.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/L2Spawn.java (working copy) @@ -317,8 +317,8 @@ _scheduledCount++; // Create a new SpawnTask to launch after the respawn Delay - //ClientScheduler.getInstance().scheduleLow(new SpawnTask(npcId), _respawnDelay); - ClientScheduler.getInstance().scheduleLow(new SpawnTask(oldNpc), _respawnDelay); + //ClientScheduler.getInstance().scheduleSpawn(new SpawnTask(npcId), _respawnDelay); + ClientScheduler.getInstance().scheduleSpawn(new SpawnTask(oldNpc), _respawnDelay); } } Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/L2Character.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/L2Character.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/L2Character.java (working copy) @@ -416,7 +416,7 @@ { // If L2PcInstance doesn't have enough MP, stop the attack - ClientScheduler.getInstance().scheduleMed(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), 1000); + ClientScheduler.getInstance().scheduleAi(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), 1000); sendPacket(new SystemMessage(SystemMessage.NOT_ENOUGH_MP)); @@ -436,7 +436,7 @@ else { // Cancel the action because the bow can't be re-use at this moment - ClientScheduler.getInstance().scheduleMed(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), 1000); + ClientScheduler.getInstance().scheduleAi(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), 1000); ActionFailed af = new ActionFailed(); sendPacket(af); @@ -522,7 +522,7 @@ int reuse = weaponItem==null ? 0 : weaponItem.getAttackReuseDelay(); // Notify AI with EVT_READY_TO_ACT - ClientScheduler.getInstance().scheduleMed(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), sAtk+reuse); + ClientScheduler.getInstance().scheduleAi(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), sAtk+reuse); } /** @@ -598,7 +598,7 @@ } // Create a new hit task with Medium priority - ClientScheduler.getInstance().scheduleMed(new HitTask(target, damage1, crit1, miss1, attack._soulshot, shld1), sAtk); + ClientScheduler.getInstance().scheduleAi(new HitTask(target, damage1, crit1, miss1, attack._soulshot, shld1), sAtk); // Calculate and set the disable delay of the bow in function of the Attack Speed _disableBowAttackEndTime = (sAtk+reuse)/GameTimeController.MILLIS_IN_TICK + GameTimeController.getGameTicks(); @@ -670,10 +670,10 @@ } // Create a new hit task with Medium priority for hit 1 - ClientScheduler.getInstance().scheduleMed(new HitTask(target, damage1, crit1, miss1, attack._soulshot, shld1), 650); + ClientScheduler.getInstance().scheduleAi(new HitTask(target, damage1, crit1, miss1, attack._soulshot, shld1), 650); // Create a new hit task with Medium priority for hit 2 with a higher delay - ClientScheduler.getInstance().scheduleMed(new HitTask(target, damage2, crit2, miss2, attack._soulshot, shld2), 1250); + ClientScheduler.getInstance().scheduleAi(new HitTask(target, damage2, crit2, miss2, attack._soulshot, shld2), 1250); // Add those hits to the Server-Client packet Attack attack.addHit(target, damage1, miss1, crit1, shld1); @@ -830,7 +830,7 @@ } // Create a new hit task with Medium priority - ClientScheduler.getInstance().scheduleMed(new HitTask(target, damage1, crit1, miss1, attack._soulshot, shld1), 980); + ClientScheduler.getInstance().scheduleAi(new HitTask(target, damage1, crit1, miss1, attack._soulshot, shld1), 980); // Add this hit to the Server-Client packet Attack attack.addHit(target, damage1, miss1, crit1, shld1); @@ -919,12 +919,10 @@ getAI().notifyEvent(CtrlEvent.EVT_CANCEL); return; } - - /* - if (Config.DEBUG) - _log.warning("L2Character: doCast -> " + skill + " " + target + " " + targets); - */ + if (Config.DEBUG) + _log.warning("L2Character: doCast -> " + skill.getName() + " " + target.getName() + " " + targets); + // Get the Identifier of the skill int magicId = skill.getId(); @@ -1009,7 +1007,7 @@ if (reuseDelay > 10) { disableSkill(skill.getId()); - ClientScheduler.getInstance().scheduleMed(new EnableSkill(skill.getId()), reuseDelay); + ClientScheduler.getInstance().scheduleAi(new EnableSkill(skill.getId()), reuseDelay); } // launch the magic in skillTime milliseconds @@ -1024,7 +1022,7 @@ // Disable all skills during the casting time and create a task EnableAllSkills with Medium priority to enable all skills at the end of the cating time disableAllSkills(); - ClientScheduler.getInstance().scheduleMed(new EnableAllSkills(skill), skillTime); + ClientScheduler.getInstance().scheduleAi(new EnableAllSkills(skill), skillTime); if (_skillCast != null) { @@ -1033,7 +1031,7 @@ } // Create a task MagicUseTask with Medium priority to launch the MagicSkill at the end of the casting time - _skillCast = ClientScheduler.getInstance().scheduleMed(new MagicUseTask(targets, skill), skillTime); + _skillCast = ClientScheduler.getInstance().scheduleAi(new MagicUseTask(targets, skill), skillTime); } else { @@ -1277,7 +1275,7 @@ if(_IsAttacked || value) _LastAttackChange = GameTimeController.getGameTicks(); // launch the task for attacking stance - if(value && !_IsAttacked) ClientScheduler.getInstance().scheduleLow(new AttackingStanceTask(), 15000); + if(value && !_IsAttacked) ClientScheduler.getInstance().scheduleAi(new AttackingStanceTask(), 15000); _IsAttacked = value; } @@ -1422,13 +1420,13 @@ if(GameTimeController.getGameTicks() - _LastAttackChange < 15 * GameTimeController.TICKS_PER_SECOND) { int time = 15 * GameTimeController.TICKS_PER_SECOND - (GameTimeController.getGameTicks() - _LastAttackChange); - ClientScheduler.getInstance().scheduleLow(new AttackingStanceTask(), time); + ClientScheduler.getInstance().scheduleAi(new AttackingStanceTask(), time); } // last attack time is less than 15s else if(GameTimeController.getGameTicks() - getAttackEndTime() < 15 * GameTimeController.TICKS_PER_SECOND) { int time = 15 * GameTimeController.TICKS_PER_SECOND - (GameTimeController.getGameTicks() - getAttackEndTime()); - ClientScheduler.getInstance().scheduleLow(new AttackingStanceTask(), time); + ClientScheduler.getInstance().scheduleAi(new AttackingStanceTask(), time); } else { @@ -3298,7 +3296,7 @@ // Create a task to notify the AI that L2Character arrives at a check point of the movement if (tm > 3000) - ClientScheduler.getInstance().scheduleMed( new NotifyAITask(CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000); + ClientScheduler.getInstance().scheduleAi( new NotifyAITask(CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000); // the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive // to destination by GameTimeController @@ -4326,7 +4324,7 @@ { updatePvPFlag(1); - _PvPRegTask = ClientScheduler.getInstance().scheduleLowAtFixedRate( + _PvPRegTask = ClientScheduler.getInstance().scheduleOtherAtFixedRate( new PvPFlag(), 1000, 1000); } @@ -4359,7 +4357,7 @@ // public void checkPvPFlag() // { // if (Config.DEBUG) _log.fine("Checking PvpFlag"); -// _PvPRegTask = ClientScheduler.getInstance().scheduleLowAtFixedRate( +// _PvPRegTask = ClientScheduler.getInstance().scheduleOtherAtFixedRate( // new PvPFlag(), 1000, 5000); // _PvPRegActive = true; // // _log.fine("PvP recheck"); Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/entity/Castle.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/entity/Castle.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/entity/Castle.java (working copy) @@ -214,7 +214,7 @@ clan.setHasCastle(getCastleId()); // Set has castle flag for new owner new Announcements().announceToAll(clan.getName() + " has taken " + getName() + " castle!"); updateOwnerInDB(clan); // Update in database - ClientScheduler.getInstance().scheduleLow(new CastleUpdater(clan, 1), 3600000); // Schedule owner tasks to start running + ClientScheduler.getInstance().scheduleSiege(new CastleUpdater(clan, 1), 3600000); // Schedule owner tasks to start running if (getSiege().getIsInProgress()) // If siege in progress getSiege().midVictory(); // Mid victory phase of siege @@ -345,7 +345,7 @@ if (getOwnerId() > 0) { L2Clan clan = ClanTable.getInstance().getClan(getOwnerId()); // Try to find clan instance - ClientScheduler.getInstance().scheduleLow(new CastleUpdater(clan, 1), 3600000); // Schedule owner tasks to start running + ClientScheduler.getInstance().scheduleSiege(new CastleUpdater(clan, 1), 3600000); // Schedule owner tasks to start running } statement.close(); Index: C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/entity/Siege.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/entity/Siege.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/model/entity/Siege.java (working copy) @@ -122,27 +122,27 @@ long timeRemaining = _SiegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis(); if (timeRemaining > 3600000) { - ClientScheduler.getInstance().scheduleLow(new ScheduleEndSiegeTask(_Castle), timeRemaining - 3600000); // Prepare task for 1 hr left. + ClientScheduler.getInstance().scheduleSiege(new ScheduleEndSiegeTask(_Castle), timeRemaining - 3600000); // Prepare task for 1 hr left. } else if ((timeRemaining <= 3600000) && (timeRemaining > 600000)) { announceToPlayer(Math.round(timeRemaining / 60000) + " minute(s) until " + getCastle().getName() + " siege conclusion.", true); - ClientScheduler.getInstance().scheduleLow(new ScheduleEndSiegeTask(_Castle), timeRemaining - 600000); // Prepare task for 10 minute left. + ClientScheduler.getInstance().scheduleSiege(new ScheduleEndSiegeTask(_Castle), timeRemaining - 600000); // Prepare task for 10 minute left. } else if ((timeRemaining <= 600000) && (timeRemaining > 300000)) { announceToPlayer(Math.round(timeRemaining / 60000) + " minute(s) until " + getCastle().getName() + " siege conclusion.", true); - ClientScheduler.getInstance().scheduleLow(new ScheduleEndSiegeTask(_Castle), timeRemaining - 300000); // Prepare task for 5 minute left. + ClientScheduler.getInstance().scheduleSiege(new ScheduleEndSiegeTask(_Castle), timeRemaining - 300000); // Prepare task for 5 minute left. } else if ((timeRemaining <= 300000) && (timeRemaining > 10000)) { announceToPlayer(Math.round(timeRemaining / 60000) + " minute(s) until " + getCastle().getName() + " siege conclusion.", true); - ClientScheduler.getInstance().scheduleLow(new ScheduleEndSiegeTask(_Castle), timeRemaining - 10000); // Prepare task for 10 seconds count down + ClientScheduler.getInstance().scheduleSiege(new ScheduleEndSiegeTask(_Castle), timeRemaining - 10000); // Prepare task for 10 seconds count down } else if ((timeRemaining <= 10000) && (timeRemaining > 0)) { announceToPlayer(getCastle().getName() + " siege " + Math.round(timeRemaining / 1000) + " second(s) left!", true); - ClientScheduler.getInstance().scheduleLow(new ScheduleEndSiegeTask(_Castle), timeRemaining); // Prepare task for second count down + ClientScheduler.getInstance().scheduleSiege(new ScheduleEndSiegeTask(_Castle), timeRemaining); // Prepare task for second count down } else { @@ -173,34 +173,34 @@ long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis(); if (timeRemaining > 86400000) { - ClientScheduler.getInstance().scheduleLow(new ScheduleStartSiegeTask(_Castle), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration + ClientScheduler.getInstance().scheduleSiege(new ScheduleStartSiegeTask(_Castle), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration } else if ((timeRemaining <= 86400000) && (timeRemaining > 13600000)) { announceToPlayer("The registration term for " + getCastle().getName() + " has ended.", false); _IsRegistrationOver = true; clearSiegeWaitingClan(); - ClientScheduler.getInstance().scheduleLow(new ScheduleStartSiegeTask(_Castle), timeRemaining - 13600000); // Prepare task for 1 hr left before siege start. + ClientScheduler.getInstance().scheduleSiege(new ScheduleStartSiegeTask(_Castle), timeRemaining - 13600000); // Prepare task for 1 hr left before siege start. } else if ((timeRemaining <= 13600000) && (timeRemaining > 600000)) { announceToPlayer(Math.round(timeRemaining / 60000) + " minute(s) until " + getCastle().getName() + " siege begin.", false); - ClientScheduler.getInstance().scheduleLow(new ScheduleStartSiegeTask(_Castle), timeRemaining - 600000); // Prepare task for 10 minute left. + ClientScheduler.getInstance().scheduleSiege(new ScheduleStartSiegeTask(_Castle), timeRemaining - 600000); // Prepare task for 10 minute left. } else if ((timeRemaining <= 600000) && (timeRemaining > 300000)) { announceToPlayer(Math.round(timeRemaining / 60000) + " minute(s) until " + getCastle().getName() + " siege begin.", false); - ClientScheduler.getInstance().scheduleLow(new ScheduleStartSiegeTask(_Castle), timeRemaining - 300000); // Prepare task for 5 minute left. + ClientScheduler.getInstance().scheduleSiege(new ScheduleStartSiegeTask(_Castle), timeRemaining - 300000); // Prepare task for 5 minute left. } else if ((timeRemaining <= 300000) && (timeRemaining > 10000)) { announceToPlayer(Math.round(timeRemaining / 60000) + " minute(s) until " + getCastle().getName() + " siege begin.", false); - ClientScheduler.getInstance().scheduleLow(new ScheduleStartSiegeTask(_Castle), timeRemaining - 10000); // Prepare task for 10 seconds count down + ClientScheduler.getInstance().scheduleSiege(new ScheduleStartSiegeTask(_Castle), timeRemaining - 10000); // Prepare task for 10 seconds count down } else if ((timeRemaining <= 10000) && (timeRemaining > 0)) { announceToPlayer(getCastle().getName() + " siege " + Math.round(timeRemaining / 1000) + " second(s) to start!", false); - ClientScheduler.getInstance().scheduleLow(new ScheduleStartSiegeTask(_Castle), timeRemaining); // Prepare task for second count down + ClientScheduler.getInstance().scheduleSiege(new ScheduleStartSiegeTask(_Castle), timeRemaining); // Prepare task for second count down } else { @@ -339,7 +339,7 @@ // Schedule a task to prepare auto siege end _SiegeEndDate = Calendar.getInstance(); _SiegeEndDate.add(Calendar.MINUTE, SiegeManager.getInstance().getSiegeLength()); - ClientScheduler.getInstance().scheduleLow(new ScheduleEndSiegeTask(getCastle()), 1000); // Prepare auto end task + ClientScheduler.getInstance().scheduleSiege(new ScheduleEndSiegeTask(getCastle()), 1000); // Prepare auto end task announceToPlayer("The siege of " + getCastle().getName() + " has started!", false); } @@ -649,7 +649,7 @@ _SiegeRegistrationEndDate.add(Calendar.DAY_OF_MONTH, -1); // Schedule siege auto start - ClientScheduler.getInstance().scheduleLow(new Siege.ScheduleStartSiegeTask(getCastle()), 1000); + ClientScheduler.getInstance().scheduleSiege(new Siege.ScheduleStartSiegeTask(getCastle()), 1000); } /** 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/CastleUpdater.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/CastleUpdater.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/CastleUpdater.java (working copy) @@ -68,7 +68,7 @@ // re-run again in 1 hours CastleUpdater cu = new CastleUpdater(_clan, _RunCount); - ClientScheduler.getInstance().scheduleLow(cu, 3600000); + ClientScheduler.getInstance().scheduleOther(cu, 3600000); } } catch (Throwable e) { e.printStackTrace(); 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().scheduleSiegeAiAtFixedRate(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) @@ -31,20 +31,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).

- * - * Threads pools :

- *
  • A pool containing 4 Hight Threads
  • - *
  • A pool containing 10 Medium Threads
  • - *
  • A pool containing 4 Low priority Threads


  • - * - */ - 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 +42,113 @@ 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 _executorTask; + private final ScheduledThreadPoolExecutor _executorSpawn; + private final ScheduledThreadPoolExecutor _executorPotion; // only for "drinkable" type of potions + private final ScheduledThreadPoolExecutor _executorEffect; // 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 _executorSiege; + private final ScheduledThreadPoolExecutor _executorActor; + 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.

    - */ + 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.

    - */ 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")); + _executorTask = new ScheduledThreadPoolExecutor(Config.THREAD_P_TASK, new ThrFactory(Config.EXECUTOR_PRI_TASK, "PoolTask")); + _executorSpawn = new ScheduledThreadPoolExecutor(Config.THREAD_P_SPAWN, new ThrFactory(Config.EXECUTOR_PRI_SPAWN, "PoolSpawn")); + _executorPotion = new ScheduledThreadPoolExecutor(Config.THREAD_P_POTION, new ThrFactory(Config.EXECUTOR_PRI_POTION, "PoolPotion")); + _executorEffect = new ScheduledThreadPoolExecutor(Config.THREAD_P_EFFECT, new ThrFactory(Config.EXECUTOR_PRI_EFFECT, "PoolEffect")); + _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")); + _executorSiege = new ScheduledThreadPoolExecutor(Config.THREAD_P_SIEGE, new ThrFactory(Config.EXECUTOR_PRI_SIEGE, "PoolSiege")); + _executorActor = new ScheduledThreadPoolExecutor(Config.THREAD_P_SIEGE, new ThrFactory(Config.EXECUTOR_PRI_ACTOR, "PoolActor")); + _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.

    - */ 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 { _executorTask.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); } + try { _executorTask.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); } + _executorTask.shutdownNow(); + + try { _executorSpawn.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); } + try { _executorSpawn.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); } + _executorSpawn.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 { _executorEffect.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); } + try { _executorEffect.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); } + _executorEffect.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 { _executorSiege.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); } + try { _executorSiege.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); } + _executorSiege.shutdownNow(); + + try { _executorActor.shutdown(); } catch (Throwable t) { _log.log(Level.WARNING, "", t); } + try { _executorActor.awaitTermination(1000, TimeUnit.MILLISECONDS); } catch (Throwable t) { _log.log(Level.WARNING, "", t); } + _executorActor.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 +170,288 @@ 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.

    - * - * Example of use :

    - *
  • Cubic Task


  • - * - * @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.

    - * - * @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.

    - * - * Example of use :

    - *
  • MP/HP Regeneration Task
  • - *
  • Auto SoulShot


  • - * - * @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.

    - * - * Example of use :

    - *
  • AI change intention
  • - *
  • Game time controller
  • - *
  • MP/HP Regeneration Task
  • - *
  • Effect Task
  • - *
  • Monster race


  • - * - * @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.

    - * - * @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 scheduleTaskAtFixedRate(Runnable r, long initial, long delay) + { + try + { + if (delay < 0) delay = 0; + return _executorTask.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS); + } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ } + } + public ScheduledFuture scheduleSpawnAtFixedRate(Runnable r, long initial, long delay) + { + try + { + if (delay < 0) delay = 0; + return _executorSpawn.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 scheduleEffectAtFixedRate(Runnable r, long initial, long delay) + { + try + { + if (delay < 0) delay = 0; + return _executorEffect.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 scheduleSiegeAtFixedRate(Runnable r, long initial, long delay) + { + try + { + if (delay < 0) delay = 0; + return _executorSiege.scheduleAtFixedRate(r, initial, delay, TimeUnit.MILLISECONDS); + } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ } + } + public ScheduledFuture scheduleActorAtFixedRate(Runnable r, long initial, long delay) + { + try + { + if (delay < 0) delay = 0; + return _executorActor.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).

    - * - * @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).

    - * - * @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).

    - * - * @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 scheduleTask(Runnable r, long delay) + { + try + { + if (delay < 0) delay = 0; + return _executorTask.schedule(r, delay, TimeUnit.MILLISECONDS); + } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ } + } + public ScheduledFuture scheduleSpawn(Runnable r, long delay) + { + try + { + if (delay < 0) delay = 0; + return _executorSpawn.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 scheduleEffect(Runnable r, long delay) + { + try + { + if (delay < 0) delay = 0; + return _executorEffect.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 scheduleSiege(Runnable r, long delay) + { + try + { + if (delay < 0) delay = 0; + return _executorSiege.schedule(r, delay, TimeUnit.MILLISECONDS); + } catch (RejectedExecutionException e) { return null; /* shutdown, ignore */ } + } + public ScheduledFuture scheduleActor(Runnable r, long delay) + { + try + { + if (delay < 0) delay = 0; + return _executorActor.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 +478,104 @@ { 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()), + "TASK ("+Config.EXECUTOR_PRI_TASK+")", + "ActiveThreads: "+_executorTask.getActiveCount(), + "CompletedTasks: "+_executorTask.getCompletedTaskCount(), + "getCorePoolSize: "+_executorTask.getCorePoolSize(), + "PoolSize: "+_executorTask.getPoolSize(), + "ScheduledTasks: "+(_executorTask.getTaskCount() - _executorTask.getCompletedTaskCount()), + "SPAWN ("+Config.EXECUTOR_PRI_SPAWN+")", + "ActiveThreads: "+_executorSpawn.getActiveCount(), + "CompletedTasks: "+_executorSpawn.getCompletedTaskCount(), + "getCorePoolSize: "+_executorSpawn.getCorePoolSize(), + "PoolSize: "+_executorSpawn.getPoolSize(), + "ScheduledTasks: "+(_executorSpawn.getTaskCount() - _executorSpawn.getCompletedTaskCount()), + "POTION ("+Config.EXECUTOR_PRI_POTION+")", + "ActiveThreads: "+_executorPotion.getActiveCount(), + "CompletedTasks: "+_executorPotion.getCompletedTaskCount(), + "getCorePoolSize: "+_executorPotion.getCorePoolSize(), + "PoolSize: "+_executorPotion.getPoolSize(), + "ScheduledTasks: "+(_executorPotion.getTaskCount() - _executorPotion.getCompletedTaskCount()), + "EFFECT ("+Config.EXECUTOR_PRI_EFFECT+")", + "ActiveThreads: "+_executorEffect.getActiveCount(), + "CompletedTasks: "+_executorEffect.getCompletedTaskCount(), + "getCorePoolSize: "+_executorEffect.getCorePoolSize(), + "PoolSize: "+_executorEffect.getPoolSize(), + "ScheduledTasks: "+(_executorEffect.getTaskCount() - _executorEffect.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()), + "SIEGE ("+Config.EXECUTOR_PRI_SIEGE+")", + "ActiveThreads: "+_executorSiege.getActiveCount(), + "CompletedTasks: "+_executorSiege.getCompletedTaskCount(), + "getCorePoolSize: "+_executorSiege.getCorePoolSize(), + "PoolSize: "+_executorSiege.getPoolSize(), + "ScheduledTasks: "+(_executorSiege.getTaskCount() - _executorSiege.getCompletedTaskCount()), + "ACTOR ("+Config.EXECUTOR_PRI_ACTOR+")", + "ActiveThreads: "+_executorActor.getActiveCount(), + "CompletedTasks: "+_executorActor.getCompletedTaskCount(), + "getCorePoolSize: "+_executorActor.getCorePoolSize(), + "PoolSize: "+_executorActor.getPoolSize(), + "ScheduledTasks: "+(_executorActor.getTaskCount() - _executorActor.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/taskmanager/TaskManager.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/taskmanager/TaskManager.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/taskmanager/TaskManager.java (working copy) @@ -235,7 +235,7 @@ else if (type == TYPE_SHEDULED) { long delay = Long.valueOf(task.getParams()[0]); - task._scheduled = scheduler.scheduleLow(task, delay); + task._scheduled = scheduler.scheduleTask(task, delay); return true; } else if (type == TYPE_FIXED_SHEDULED) @@ -243,7 +243,7 @@ long delay = Long.valueOf(task.getParams()[0]); long interval = Long.valueOf(task.getParams()[1]); - task._scheduled = scheduler.scheduleLowAtFixedRate(task,delay,interval); + task._scheduled = scheduler.scheduleTaskAtFixedRate(task,delay,interval); return true; } else if (type == TYPE_TIME) @@ -253,7 +253,7 @@ long diff = desired.getTime() - System.currentTimeMillis(); if (diff >= 0) { - task._scheduled = scheduler.scheduleLow(task, diff); + task._scheduled = scheduler.scheduleTask(task, diff); return true; } _log.info("Task " + task.getId() + " is obsoleted."); @@ -302,7 +302,7 @@ delay += interval; } - task._scheduled = scheduler.scheduleLowAtFixedRate(task,delay,interval); + task._scheduled = scheduler.scheduleTaskAtFixedRate(task,delay,interval); return true; } 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/gameserver/GameTimeController.java =================================================================== --- C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/GameTimeController.java (revision 1580) +++ C:/workspace/C4-Alpha/java/net/sf/l2j/gameserver/GameTimeController.java (working copy) @@ -72,9 +72,9 @@ _timer = new TimerThread(); _timer.start(); - ClientScheduler.getInstance().scheduleLowAtFixedRate( + ClientScheduler.getInstance().scheduleOtherAtFixedRate( new TimerWatcher(), 0, 1000); - ClientScheduler.getInstance().scheduleLowAtFixedRate( + ClientScheduler.getInstance().scheduleOtherAtFixedRate( new BroadcastSunState(), 0, 60*60*1000 ); } @@ -151,7 +151,7 @@ // Create a task to update the _knownObject and _knowPlayers of each L2Character that finished its movement and of their already known L2Object // then notify AI with EVT_ARRIVED if (ended != null) - ClientScheduler.getInstance().scheduleLow(new MovingObjectArrived(ended), 10); + ClientScheduler.getInstance().scheduleOther(new MovingObjectArrived(ended), 10); } @@ -201,7 +201,7 @@ if (!_timer.isAlive()) { String time = (new SimpleDateFormat("HH:mm:ss")).format(new Date()); - _log.warning(time+" TimerThread stop with following error. restart it."); + _log.warning(time+" TimerThread stop with following error. restarting it."); if (_timer._error != null) _timer._error.printStackTrace(); 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 @@ - L2_GameServer_c4 + C4-Alpha L2_Logging @@ -15,4 +15,11 @@ org.eclipse.jdt.core.javanature + + + classes + 2 + C:/workspace/C4-Alpha/build/classes + + 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 @@ - + 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 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + +