Beispiel #1
0
        public bool startup()
        {
#if !UseTimer
            _ScheduleExecutor.start();
#endif
            return(true);
        }
Beispiel #2
0
        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);
 }
Beispiel #4
0
 public bool startup()
 {
     _ScheduleExecutor.start();
     return(true);
 }