Пример #1
0
        public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
        {
            m_server                   = pSrv;
            m_WorkerThreadCount        = pWorkerThreadCount;
            m_workerThreads            = new Thread[m_WorkerThreadCount];
            m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];

            //startup worker threads
            for (uint i = 0; i < m_WorkerThreadCount; i++)
            {
                m_PollServiceWorkerThreads[i]          = new PollServiceWorkerThread(m_server, pTimeout);
                m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;

                m_workerThreads[i]      = new Thread(m_PollServiceWorkerThreads[i].ThreadStart);
                m_workerThreads[i].Name = String.Format("PollServiceWorkerThread{0}", i);

                //Can't add to thread Tracker here Referencing OpenSim.Framework creates circular reference
                m_workerThreads[i].Start();
            }

            //start watcher threads
            m_watcherThread      = new Thread(ThreadStart);
            m_watcherThread.Name = "PollServiceWatcherThread";
            m_watcherThread.Start();
        }
        public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
        {
            m_server = pSrv;
            m_WorkerThreadCount = pWorkerThreadCount;
            m_workerThreads = new Thread[m_WorkerThreadCount];
            m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];

            //startup worker threads
            for (uint i=0;i<m_WorkerThreadCount;i++)
            {
                m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, pTimeout);
                m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;
               
                m_workerThreads[i] = new Thread(m_PollServiceWorkerThreads[i].ThreadStart);
                m_workerThreads[i].Name = String.Format("PollServiceWorkerThread{0}",i);
                //Can't add to thread Tracker here Referencing OpenSim.Framework creates circular reference
                m_workerThreads[i].Start();
                
            }

            //start watcher threads
            m_watcherThread = new Thread(ThreadStart);
            m_watcherThread.Name = "PollServiceWatcherThread";
            m_watcherThread.Start();
        }
        public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
        {
            m_server                   = pSrv;
            m_WorkerThreadCount        = pWorkerThreadCount;
            m_workerThreads            = new Thread[m_WorkerThreadCount];
            m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];

            //startup worker threads
            for (uint i = 0; i < m_WorkerThreadCount; i++)
            {
                m_PollServiceWorkerThreads[i]          = new PollServiceWorkerThread(m_server, pTimeout);
                m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;

                m_workerThreads[i]
                    = Watchdog.StartThread(
                          m_PollServiceWorkerThreads[i].ThreadStart,
                          String.Format("PollServiceWorkerThread{0}", i),
                          ThreadPriority.Normal,
                          false,
                          true,
                          int.MaxValue);
            }

            Watchdog.StartThread(
                this.ThreadStart,
                "PollServiceWatcherThread",
                ThreadPriority.Normal,
                false,
                true,
                1000 * 60 * 10);
        }
        public void Start()
        {
            m_running                  = true;
            m_workerThreads            = new Thread[m_WorkerThreadCount];
            m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];

            //startup worker threads
            for (uint i = 0; i < m_WorkerThreadCount; i++)
            {
                m_PollServiceWorkerThreads[i]          = new PollServiceWorkerThread(m_server, m_pollTimeout);
                m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;

                m_workerThreads[i]
                    = Watchdog.StartThread(
                          m_PollServiceWorkerThreads[i].ThreadStart,
                          String.Format("PollServiceWorkerThread{0}", i),
                          ThreadPriority.Normal,
                          false,
                          true,
                          null,
                          int.MaxValue);
            }

            Watchdog.StartThread(
                this.ThreadStart,
                "PollServiceWatcherThread",
                ThreadPriority.Normal,
                false,
                true,
                null,
                1000 * 60 * 10);
        }
Пример #5
0
        public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
        {
            m_server = pSrv;
            m_WorkerThreadCount = pWorkerThreadCount;
            m_workerThreads = new Thread[m_WorkerThreadCount];
            m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];

            //startup worker threads
            for (uint i = 0; i < m_WorkerThreadCount; i++)
            {
                m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, pTimeout);
                m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;

                m_workerThreads[i]
                    = Watchdog.StartThread(
                        m_PollServiceWorkerThreads[i].ThreadStart,
                        String.Format("PollServiceWorkerThread{0}", i),
                        ThreadPriority.Normal,
                        false,
                        true,
                        null,
                        int.MaxValue);
            }

            Watchdog.StartThread(
                this.ThreadStart,
                "PollServiceWatcherThread",
                ThreadPriority.Normal,
                false,
                true,
                null,
                1000 * 60 * 10);
        }
        public void Start()
        {
            m_running = true;
            m_workerThreads = new Thread[m_WorkerThreadCount];
            m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];

            //startup worker threads
            for (uint i = 0; i < m_WorkerThreadCount; i++)
            {
                m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, m_pollTimeout);
                m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;

                m_workerThreads[i]
                    = Watchdog.StartThread(
                        m_PollServiceWorkerThreads[i].ThreadStart,
                        String.Format("PollServiceWorkerThread{0}", i),
                        ThreadPriority.Normal,
                        false,
                        true,
                        null,
                        int.MaxValue);
            }

            Watchdog.StartThread(
                this.ThreadStart,
                "PollServiceWatcherThread",
                ThreadPriority.Normal,
                false,
                true,
                null,
                1000 * 60 * 10);
        }
        public void Stop()
        {
            m_running = false;

            foreach (object o in m_requests)
            {
                PollServiceHttpRequest req = (PollServiceHttpRequest)o;
                PollServiceWorkerThread.DoHTTPGruntWork(
                    m_server, req, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
            }

            m_requests.Clear();

            foreach (Thread t in m_workerThreads)
            {
                t.Abort();
            }
        }
        private void PokeThreads()
        {
            if (m_threadRunning)
                return;

            m_threadRunning = true;
            //startup worker threads
            for (uint i = 0; i < m_WorkerThreadCount; i++)
            {
                if (m_PollServiceWorkerThreads[i] == null)
                {
                    m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, m_timeOut);
                    m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;

                    m_workerThreads[i] = new Thread(m_PollServiceWorkerThreads[i].ThreadStart)
                                             {Name = String.Format("PollServiceWorkerThread{0}", i)};
                    //Can't add to thread Tracker here Referencing OpenSim.Framework creates circular reference
                    m_workerThreads[i].Start();
                }
            }

            //start watcher threads
            m_watcherThread = new Thread(ThreadStart) {Name = "PollServiceWatcherThread"};
            m_watcherThread.Start();
        }