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

@@ -22,7 +22,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.ThreadPoolManager;
@@ -203,7 +202,7 @@ public final class CastleDungeon extends AbstractInstance
*/
private void spawnRaid(Instance instance)
{
final ScheduledFuture<?> spawnTask = ThreadPoolManager.getInstance().scheduleGeneral(() ->
final ScheduledFuture<?> spawnTask = ThreadPoolManager.schedule(() ->
{
// Get template id of raid
final int npcId;
@@ -230,7 +229,7 @@ public final class CastleDungeon extends AbstractInstance
// Unset spawn task reference
instance.setParameter("spawnTask", null);
}, 2, TimeUnit.MINUTES);
}, 2 * 60 * 1000); // 2 minutes
// Save timer to instance world
instance.setParameter("spawnTask", spawnTask);

View File

@@ -111,7 +111,7 @@ public final class ChamberOfDelusion extends AbstractInstance
changeRoom(instance);
// Start banish task
final ScheduledFuture<?> banishTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(() ->
final ScheduledFuture<?> banishTask = ThreadPoolManager.scheduleAtFixedRate(() ->
{
if (instance.getRemainingTime() < 60000)
{
@@ -410,7 +410,7 @@ public final class ChamberOfDelusion extends AbstractInstance
final long nextInterval = (bossRoom) ? 60000L : (ROOM_CHANGE_INTERVAL + getRandom(ROOM_CHANGE_RANDOM_TIME)) * 1000L;
if (world.getRemainingTime() > nextInterval)
{
final ScheduledFuture<?> roomChangeTask = ThreadPoolManager.getInstance().scheduleGeneral(() ->
final ScheduledFuture<?> roomChangeTask = ThreadPoolManager.schedule(() ->
{
try
{

View File

@@ -22,7 +22,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.ThreadPoolManager;
@@ -226,7 +225,7 @@ public final class FortressDungeon extends AbstractInstance
*/
private void spawnRaid(Instance instance)
{
final ScheduledFuture<?> spawnTask = ThreadPoolManager.getInstance().scheduleGeneral(() ->
final ScheduledFuture<?> spawnTask = ThreadPoolManager.schedule(() ->
{
// Get template id of raid
final int npcId;
@@ -247,7 +246,7 @@ public final class FortressDungeon extends AbstractInstance
// Unset spawn task reference
instance.setParameter("spawnTask", null);
}, 2, TimeUnit.MINUTES);
}, 2 * 60 * 1000); // 2 minutes
// Save timer to instance world
instance.setParameter("spawnTask", spawnTask);