Browse Source

Javolution recycling.
Debug msg for CB.
ThreadPool remove old unused ai pool.

JIV 15 years ago
parent
commit
6b966a02bb

+ 5 - 21
L2_GameServer/java/com/l2jserver/gameserver/ThreadPoolManager.java

@@ -66,17 +66,13 @@ public class ThreadPoolManager
 {
 	protected static final Logger _log = Logger.getLogger(ThreadPoolManager.class.getName());
 	
-	public ScheduledThreadPoolExecutor _effectsScheduledThreadPool;
+	private ScheduledThreadPoolExecutor _effectsScheduledThreadPool;
 	private ScheduledThreadPoolExecutor _generalScheduledThreadPool;
-	
+	private ScheduledThreadPoolExecutor _aiScheduledThreadPool;
 	private ThreadPoolExecutor _generalPacketsThreadPool;
 	private ThreadPoolExecutor _ioPacketsThreadPool;
-	// will be really used in the next AI implementation.
-	private ThreadPoolExecutor _aiThreadPool;
 	private ThreadPoolExecutor _generalThreadPool;
-	
-	// temp
-	private ScheduledThreadPoolExecutor _aiScheduledThreadPool;
+
 	
 	/** temp workaround for VM issue */
 	private static final long MAX_DELAY = Long.MAX_VALUE / 1000000 / 2;
@@ -92,16 +88,9 @@ public class ThreadPoolManager
 	{
 		_effectsScheduledThreadPool = new ScheduledThreadPoolExecutor(Config.THREAD_P_EFFECTS, new PriorityThreadFactory("EffectsSTPool", Thread.NORM_PRIORITY));
 		_generalScheduledThreadPool = new ScheduledThreadPoolExecutor(Config.THREAD_P_GENERAL, new PriorityThreadFactory("GeneralSTPool", Thread.NORM_PRIORITY));
-		
 		_ioPacketsThreadPool = new ThreadPoolExecutor(Config.IO_PACKET_THREAD_CORE_SIZE, Integer.MAX_VALUE, 5L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new PriorityThreadFactory("I/O Packet Pool", Thread.NORM_PRIORITY + 1));
-		
 		_generalPacketsThreadPool = new ThreadPoolExecutor(Config.GENERAL_PACKET_THREAD_CORE_SIZE, Config.GENERAL_PACKET_THREAD_CORE_SIZE + 2, 15L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new PriorityThreadFactory("Normal Packet Pool", Thread.NORM_PRIORITY + 1));
-		
 		_generalThreadPool = new ThreadPoolExecutor(Config.GENERAL_THREAD_CORE_SIZE, Config.GENERAL_THREAD_CORE_SIZE + 2, 5L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new PriorityThreadFactory("General Pool", Thread.NORM_PRIORITY));
-		
-		// will be really used in the next AI implementation.
-		_aiThreadPool = new ThreadPoolExecutor(1, Config.AI_MAX_THREAD, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
-		
 		_aiScheduledThreadPool = new ScheduledThreadPoolExecutor(Config.AI_MAX_THREAD, new PriorityThreadFactory("AISTPool", Thread.NORM_PRIORITY));
 	}
 	
@@ -227,7 +216,7 @@ public class ThreadPoolManager
 	
 	public void executeAi(Runnable r)
 	{
-		_aiThreadPool.execute(r);
+		_aiScheduledThreadPool.execute(r);
 	}
 	
 	public String[] getStats()
@@ -284,9 +273,7 @@ public class ThreadPoolManager
 				" |- PoolSize:        " + _generalThreadPool.getPoolSize(),
 				" |- CompletedTasks:  " + _generalThreadPool.getCompletedTaskCount(),
 				" |- QueuedTasks:     " + _generalThreadPool.getQueue().size(),
-				" | -------",
-				" + AI:",
-				" |- Not Done"
+				" | -------"
 		};
 	}
 	
@@ -334,13 +321,11 @@ public class ThreadPoolManager
 			_generalPacketsThreadPool.awaitTermination(1, TimeUnit.SECONDS);
 			_ioPacketsThreadPool.awaitTermination(1, TimeUnit.SECONDS);
 			_generalThreadPool.awaitTermination(1, TimeUnit.SECONDS);
-			_aiThreadPool.awaitTermination(1, TimeUnit.SECONDS);
 			_effectsScheduledThreadPool.shutdown();
 			_generalScheduledThreadPool.shutdown();
 			_generalPacketsThreadPool.shutdown();
 			_ioPacketsThreadPool.shutdown();
 			_generalThreadPool.shutdown();
-			_aiThreadPool.shutdown();
 			_log.info("All ThreadPools are now stopped");
 			
 		}
@@ -367,7 +352,6 @@ public class ThreadPoolManager
 		_ioPacketsThreadPool.purge();
 		_generalPacketsThreadPool.purge();
 		_generalThreadPool.purge();
-		_aiThreadPool.purge();
 	}
 	
 	/**

+ 6 - 5
L2_GameServer/java/com/l2jserver/gameserver/model/CharEffectList.java

@@ -75,7 +75,7 @@ public class CharEffectList
 		}
 
 		// Create a copy of the effects
-		FastList<L2Effect> temp = new FastList<L2Effect>();
+		FastList<L2Effect> temp = FastList.newInstance();
 
 		// Add all buffs and all debuffs
 		if (_buffs != null) 
@@ -98,6 +98,7 @@ public class CharEffectList
 		// Return all effects in an array
 		L2Effect[] tempArray = new L2Effect[temp.size()];
 		temp.toArray(tempArray);
+		FastList.recycle(temp);
 		return tempArray;
 	}
 
@@ -415,7 +416,7 @@ public class CharEffectList
 	public final void stopEffects(L2EffectType type)
 	{
 		// Go through all active skills effects
-		FastList<L2Effect> temp = new FastList<L2Effect>();
+		FastList<L2Effect> temp = FastList.newInstance();
 		if (_buffs != null) 
 		{
 			synchronized (_buffs)
@@ -447,8 +448,8 @@ public class CharEffectList
 			for (L2Effect e : temp)
 				if (e != null)
 					e.exit();
-			temp.clear();
 		}
+		FastList.recycle(temp);
 	}
 
 	/**
@@ -458,7 +459,7 @@ public class CharEffectList
 	public final void stopSkillEffects(int skillId)
 	{
 		// Go through all active skills effects
-		FastList<L2Effect> temp = new FastList<L2Effect>();
+		FastList<L2Effect> temp = FastList.newInstance();
 		if (_buffs != null) 
 		{
 			synchronized (_buffs)
@@ -488,8 +489,8 @@ public class CharEffectList
 			for (L2Effect e : temp)
 				if (e != null)
 					e.exit();
-			temp.clear();
 		}
+		FastList.recycle(temp);
 	}
 
 	/**

+ 0 - 11
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2GrandBossInstance.java

@@ -15,7 +15,6 @@
 package com.l2jserver.gameserver.model.actor.instance;
 
 import com.l2jserver.gameserver.instancemanager.RaidBossPointsManager;
-import com.l2jserver.gameserver.model.L2Skill;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Summon;
 import com.l2jserver.gameserver.network.SystemMessageId;
@@ -57,16 +56,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance
 		super.onSpawn();
 	}
 	
-	/**
-	 * Reduce the current HP of the L2Attackable, update its _aggroList and launch the doDie Task if necessary.<BR><BR>
-	 *
-	 */
-	@Override
-	public void reduceCurrentHp(double damage, L2Character attacker, boolean awake, boolean isDOT, L2Skill skill)
-	{
-		super.reduceCurrentHp(damage, attacker, awake, isDOT, skill);
-	}
-	
 	/**
 	 * 
 	 * @see com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance#doDie(com.l2jserver.gameserver.model.actor.L2Character)

+ 1 - 1
L2_GameServer/java/com/l2jserver/gameserver/network/communityserver/CommunityServerThread.java

@@ -255,7 +255,7 @@ public final class CommunityServerThread extends NetConnection
 			}
 			catch (IOException e)
 			{
-				//e.printStackTrace();
+				e.printStackTrace();
 				
 				_log.log(Level.WARNING, "CommunityServerThread: TCP Connection lost!");