public bool startup() { #if !UseTimer _ScheduleExecutor.start(); #endif return(true); }
public void initialize(int capacity) { MaxConnectedClientLimit = capacity; socketListener = new SocketListener(capacity, (int)TCPCmdPacketSize.RECV_MAX_SIZE); socketListener.SocketClosed += SocketClosed; socketListener.SocketConnected += SocketConnected; socketListener.SocketReceived += SocketReceived; socketListener.SocketSended += SocketSended; _tcpClientPool = TCPClientPool.getInstance(); _tcpClientPool.initialize(100); _tcpLogClientPool = TCPClientPool.getLogInstance(); _tcpLogClientPool.initialize(100); tcpInPacketPool = new TCPInPacketPool(capacity); /*tcpOutPacketPool = new TCPOutPacketPool(capacity);*/ TCPOutPacketPool.getInstance().initialize(capacity); tcpOutPacketPool = TCPOutPacketPool.getInstance(); dictInPackets = new Dictionary <TMSKSocket, TCPInPacket>(capacity); tcpSessions = new Dictionary <TMSKSocket, TCPSession>(); TCPCmdDispatcher.getInstance().initialize(); #if UseTimer taskExecutor = new ScheduleExecutor(0); #else taskExecutor = new ScheduleExecutor(1); #endif taskExecutor.start(); }
public bool startup() { executor.start(); //延迟2秒执行,每5秒调度一次 executor.scheduleExecute(this, 2 * TimeUtil.SECOND, 5 * TimeUtil.SECOND); return(true); }
public bool startup() { _ScheduleExecutor.start(); return(true); }