Better L2jFree based ThreadPool.

Adapted from: L2jUnity free files.
This commit is contained in:
MobiusDev
2018-04-02 15:45:38 +00:00
parent 0c201f75e7
commit c071f2a1bc
53 changed files with 2953 additions and 1908 deletions

View File

@@ -177,18 +177,19 @@ public class GameServer
{
final long serverLoadStart = System.currentTimeMillis();
printSection("ThreadPool");
ThreadPool.initThreadPools(new GameThreadPools());
printSection("IdFactory");
if (!IdFactory.getInstance().isInitialized())
{
LOGGER.severe(getClass().getSimpleName() + ": Could not read object IDs from database. Please check your configuration.");
throw new Exception("Could not initialize the ID factory");
}
printSection("ThreadPool");
ThreadPool.init();
EventDispatcher.getInstance();
// load script engines
printSection("Scripting Engines");
EventDispatcher.getInstance();
ScriptEngineManager.getInstance();
printSection("Telnet");

View File

@@ -0,0 +1,38 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver;
import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.IThreadPoolInitializer;
/**
* @author nos
*/
public final class GameThreadPools implements IThreadPoolInitializer
{
@Override
public int getScheduledThreadPoolSize()
{
return Config.SCHEDULED_THREAD_POOL_COUNT != -1 ? Config.SCHEDULED_THREAD_POOL_COUNT : Runtime.getRuntime().availableProcessors() * Config.THREADS_PER_SCHEDULED_THREAD_POOL;
}
@Override
public int getThreadPoolSize()
{
return Config.INSTANT_THREAD_POOL_COUNT != -1 ? Config.INSTANT_THREAD_POOL_COUNT : Runtime.getRuntime().availableProcessors() * Config.THREADS_PER_INSTANT_THREAD_POOL;
}
}