线程创建多个

back_recharge
zhangshanxue 2020-03-16 11:00:48 +08:00
parent 85bf6d74dc
commit 3900141126
1 changed files with 3 additions and 3 deletions

View File

@ -55,13 +55,13 @@ public class ProtocolsManager implements ProtocolsAbstract {
private Map<Integer, BaseHandler> handlers = new HashMap<>(); private Map<Integer, BaseHandler> handlers = new HashMap<>();
private static ClassLoader classLoader = GameApplication.class.getClassLoader(); private static ClassLoader classLoader = GameApplication.class.getClassLoader();
public final static int HANDLER_THREAD_NUM = 50; public final static int HANDLER_THREAD_NUM = 50;
public HandlerLogicThread[] handlerThreads = new HandlerLogicThread[HANDLER_THREAD_NUM]; public static HandlerLogicThread[] handlerThreads = new HandlerLogicThread[HANDLER_THREAD_NUM];
private ProtocolsManager() { static {
initContext(); initContext();
} }
public void initContext() { private static void initContext() {
for (int i = 0; i < HANDLER_THREAD_NUM; i++) { for (int i = 0; i < HANDLER_THREAD_NUM; i++) {
handlerThreads[i] = new HandlerLogicThread(); handlerThreads[i] = new HandlerLogicThread();
handlerThreads[i].setPriority(9);//优先级最高 handlerThreads[i].setPriority(9);//优先级最高