ThreadPool manager rework.

This commit is contained in:
MobiusDev
2017-08-23 05:23:31 +00:00
parent 374c53df4b
commit b77de360af
718 changed files with 3180 additions and 7193 deletions

View File

@@ -836,7 +836,7 @@ public abstract class AbstractAI implements Ctrl
// Create and Launch an AI Follow Task to execute every 1s
_followTarget = target;
_followTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new FollowTask(), 5, FOLLOW_INTERVAL);
_followTask = ThreadPoolManager.scheduleAtFixedRate(new FollowTask(), 5, FOLLOW_INTERVAL);
}
/**
@@ -853,7 +853,7 @@ public abstract class AbstractAI implements Ctrl
}
_followTarget = target;
_followTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new FollowTask(range), 5, ATTACK_FOLLOW_INTERVAL);
_followTask = ThreadPoolManager.scheduleAtFixedRate(new FollowTask(range), 5, ATTACK_FOLLOW_INTERVAL);
}
/**

View File

@@ -24,7 +24,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.GameTimeController;
@@ -301,7 +300,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
// If not idle - create an AI task (schedule onEvtThink repeatedly)
if (_aiTask == null)
{
_aiTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 1000, 1000);
_aiTask = ThreadPoolManager.scheduleAtFixedRate(this, 1000, 1000);
}
}
@@ -400,7 +399,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
if ((_fearTime > 0) && (_fearTask == null))
{
_fearTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new FearTask(this, effector, start), 0, FEAR_TICKS, TimeUnit.SECONDS);
_fearTask = ThreadPoolManager.scheduleAtFixedRate(new FearTask(this, effector, start), 0, FEAR_TICKS * 1000); // seconds
_actor.startAbnormalVisualEffect(true, AbnormalVisualEffect.TURN_FLEE);
}
else

View File

@@ -311,7 +311,7 @@ public class L2CharacterAI extends AbstractAI
if (_actor.getBowAttackEndTime() > GameTimeController.getInstance().getGameTicks())
{
ThreadPoolManager.getInstance().scheduleGeneral(new CastTask(_actor, skill, target), (_actor.getBowAttackEndTime() - GameTimeController.getInstance().getGameTicks()) * GameTimeController.MILLIS_IN_TICK);
ThreadPoolManager.schedule(new CastTask(_actor, skill, target), (_actor.getBowAttackEndTime() - GameTimeController.getInstance().getGameTicks()) * GameTimeController.MILLIS_IN_TICK);
}
else
{

View File

@@ -87,7 +87,7 @@ public class L2DoorAI extends L2CharacterAI
@Override
protected void onEvtAttacked(L2Character attacker)
{
ThreadPoolManager.getInstance().executeGeneral(new onEventAttackedDoorTask((L2DoorInstance) _actor, attacker));
ThreadPoolManager.execute(new onEventAttackedDoorTask((L2DoorInstance) _actor, attacker));
}
@Override

View File

@@ -205,7 +205,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
// If not idle - create an AI task (schedule onEvtThink repeatedly)
if (_aiTask == null)
{
_aiTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 1000, 1000);
_aiTask = ThreadPoolManager.scheduleAtFixedRate(this, 1000, 1000);
}
}

View File

@@ -203,7 +203,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
// If not idle - create an AI task (schedule onEvtThink repeatedly)
if (_aiTask == null)
{
_aiTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 1000, 1000);
_aiTask = ThreadPoolManager.scheduleAtFixedRate(this, 1000, 1000);
}
}

View File

@@ -295,7 +295,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
{
if (_avoidTask == null)
{
_avoidTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 100, 100);
_avoidTask = ThreadPoolManager.scheduleAtFixedRate(this, 100, 100);
}
}