Addition of ThreadProvider class.
This commit is contained in:
parent
8c63798e84
commit
98ce347b37
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -1,19 +1,18 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* 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 2 of the License, or
|
||||
* 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.
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.threads;
|
||||
|
||||
@ -53,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -61,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.gameserver.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class ThreadPool
|
||||
// Feed scheduled pool.
|
||||
for (int i = 0; i < Config.SCHEDULED_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL);
|
||||
SCHEDULED_POOLS[i] = new ScheduledThreadPoolExecutor(Config.THREADS_PER_SCHEDULED_THREAD_POOL, new ThreadProvider("L2jMobius ScheduledThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.SCHEDULED_THREAD_POOL_COUNT + " scheduled pool executors with " + (Config.SCHEDULED_THREAD_POOL_COUNT * Config.THREADS_PER_SCHEDULED_THREAD_POOL) + " total threads.");
|
||||
@ -60,7 +60,7 @@ public class ThreadPool
|
||||
// Feed instant pool.
|
||||
for (int i = 0; i < Config.INSTANT_THREAD_POOL_COUNT; i++)
|
||||
{
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000));
|
||||
INSTANT_POOLS[i] = new ThreadPoolExecutor(Config.THREADS_PER_INSTANT_THREAD_POOL, Config.THREADS_PER_INSTANT_THREAD_POOL, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100000), new ThreadProvider("L2jMobius ExecuteThread " + i));
|
||||
}
|
||||
|
||||
LOGGER.info("..." + Config.INSTANT_THREAD_POOL_COUNT + " instant pool executors with " + (Config.INSTANT_THREAD_POOL_COUNT * Config.THREADS_PER_INSTANT_THREAD_POOL) + " total threads.");
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.commons.threads;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ThreadProvider implements ThreadFactory
|
||||
{
|
||||
private final String _name;
|
||||
|
||||
public ThreadProvider(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable)
|
||||
{
|
||||
final Thread thread = new Thread(runnable, _name);
|
||||
thread.setPriority(Thread.NORM_PRIORITY);
|
||||
thread.setDaemon(false);
|
||||
return thread;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user