Example #1
0
        public virtual void HandleThreadsAbort(string module, string[] cmd)
        {
            if (cmd.Length != 3)
            {
                MainConsole.Instance.Output("Usage: threads abort <thread-id>");
                return;
            }

            int threadId;

            if (!int.TryParse(cmd[2], out threadId))
            {
                MainConsole.Instance.Output("ERROR: Thread id must be an integer");
                return;
            }

            if (Watchdog.AbortThread(threadId))
            {
                MainConsole.Instance.OutputFormat("Aborted thread with id {0}", threadId);
            }
            else
            {
                MainConsole.Instance.OutputFormat("ERROR - Thread with id {0} not found in managed threads", threadId);
            }
        }
Example #2
0
        public void RemoveRegion(Scene s)
        {
            if (!m_Enabled)
            {
                return;
            }

            Scene.EventManager.OnRegisterCaps -= RegisterCaps;

            StatsManager.DeregisterStat(s_processedRequestsStat);
            StatsManager.DeregisterStat(s_queuedRequestsStat);

            if (ProcessQueuedRequestsAsync)
            {
                if (m_workerThreads != null)
                {
                    foreach (Thread t in m_workerThreads)
                    {
                        Watchdog.AbortThread(t.ManagedThreadId);
                    }

                    m_workerThreads = null;
                }
            }

            Scene = null;
        }
        public void Stop()
        {
            m_running = false;

            Thread.Sleep(1000); // let the world move

            foreach (Thread t in m_workerThreads)
            {
                Watchdog.AbortThread(t.ManagedThreadId);
            }

            // any entry in m_bycontext should have a active request on the other queues
            // so just delete contents to easy GC
            foreach (Queue <PollServiceHttpRequest> qu in m_bycontext.Values)
            {
                qu.Clear();
            }
            m_bycontext.Clear();

            try
            {
                foreach (PollServiceHttpRequest req in m_retryRequests)
                {
                    req.DoHTTPstop(m_server);
                }
            }
            catch
            {
            }

            PollServiceHttpRequest wreq;

            m_retryRequests.Clear();

            lock (m_slowRequests)
            {
                while (m_slowRequests.Count > 0)
                {
                    m_requests.Enqueue(m_slowRequests.Dequeue());
                }
            }

            while (m_requests.Count() > 0)
            {
                try
                {
                    wreq = m_requests.Dequeue(0);
                    wreq.DoHTTPstop(m_server);
                }
                catch
                {
                }
            }

            m_requests.Clear();
        }
Example #4
0
        public void Stop()
        {
            m_running = false;

            Thread.Sleep(100); // let the world move

            foreach (Thread t in m_workerThreads)
            {
                Watchdog.AbortThread(t.ManagedThreadId);
            }

            m_threadPool.Shutdown();

            // any entry in m_bycontext should have a active request on the other queues
            // so just delete contents to easy GC
            foreach (Queue <PollServiceHttpRequest> qu in m_bycontext.Values)
            {
                qu.Clear();
            }
            m_bycontext.Clear();

/*
 *          try
 *          {
 *              foreach (PollServiceHttpRequest req in m_retryRequests)
 *              {
 *                  req.DoHTTPstop(m_server);
 *              }
 *          }
 *          catch
 *          {
 *          }
 *
 *          PollServiceHttpRequest wreq;
 */
            m_retryRequests.Clear();

/*
 *          while (m_requests.Count() > 0)
 *          {
 *              try
 *              {
 *                  wreq = m_requests.Dequeue(0);
 *                  wreq.DoHTTPstop(m_server);
 *
 *              }
 *              catch
 *              {
 *              }
 *          }
 */
            m_requests.Clear();
        }
Example #5
0
 public void Close()
 {
     if (m_NumberScenes <= 0 && m_workerThreads != null)
     {
         m_log.DebugFormat("[GetMeshModule] Closing");
         foreach (Thread t in m_workerThreads)
         {
             Watchdog.AbortThread(t.ManagedThreadId);
         }
         m_queue.Clear();
     }
 }
Example #6
0
        public void Stop()
        {
            if (!m_running)
            {
                return;
            }

            m_running = false;

            Thread.Sleep(100); // let the world move

            foreach (Thread t in m_workerThreads)
            {
                Watchdog.AbortThread(t.ManagedThreadId);
            }

            m_threadPool.Shutdown();

            // any entry in m_bycontext should have a active request on the other queues
            // so just delete contents to easy GC
            foreach (Queue <PollServiceHttpRequest> qu in m_bycontext.Values)
            {
                qu.Clear();
            }
            m_bycontext.Clear();

            PollServiceHttpRequest req;

            try
            {
                while (m_retryRequests.TryDequeue(out req))
                {
                    req.DoHTTPstop();
                }
            }
            catch
            {
            }

            try
            {
                while (m_requests.TryTake(out req, 0))
                {
                    req.DoHTTPstop();
                }
            }
            catch
            {
            }

            m_requests.Dispose();
        }
Example #7
0
 public void Stop()
 {
     try
     {
         if (httpThread != null)
         {
             Watchdog.AbortThread(httpThread.ManagedThreadId);
             httpThread = null;
         }
     }
     catch (Exception)
     {
     }
 }
Example #8
0
        public void RemoveRegion(Scene s)
        {
            if (!m_Enabled)
            {
                return;
            }

            m_scene.EventManager.OnRegisterCaps -= RegisterCaps;

            foreach (Thread t in m_workerThreads)
            {
                Watchdog.AbortThread(t.ManagedThreadId);
            }

            m_scene = null;
        }
Example #9
0
 public void Close()
 {
     if (m_NumberScenes <= 0 && m_workerThreads != null)
     {
         m_log.DebugFormat("[GetAssetsModule] Closing");
         foreach (Thread t in m_workerThreads)
         {
             Watchdog.AbortThread(t.ManagedThreadId);
         }
         // This will fail on region shutdown. Its harmless.
         // Prevent red ink.
         try
         {
             m_queue.Dispose();
         }
         catch {}
     }
 }
        public void Stop()
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            m_running = false;
//            m_timeout = -10000; // cause all to expire
            Thread.Sleep(1000); // let the world move

            foreach (Thread t in m_workerThreads)
            {
                Watchdog.AbortThread(t.ManagedThreadId);
            }

            PollServiceHttpRequest wreq;

            lock (m_longPollRequests)
            {
                if (m_longPollRequests.Count > 0 && m_running)
                {
                    m_longPollRequests.ForEach(req => m_requests.Enqueue(req));
                }
            }

            while (m_requests.Count() > 0)
            {
                try
                {
                    wreq = m_requests.Dequeue(0);
                    wreq.DoHTTPGruntWork(
                        m_server, wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id));
                }
                catch
                {
                }
            }

            m_longPollRequests.Clear();
            m_requests.Clear();
        }
        public void Stop()
        {
            if (!m_running)
            {
                return;
            }

            m_running = false;

            Thread.Sleep(100); // let the world move

            foreach (Thread t in m_workerThreads)
            {
                Watchdog.AbortThread(t.ManagedThreadId);
            }

            PollServiceHttpRequest req;

            try
            {
                while (m_retryRequests.TryDequeue(out req))
                {
                    req.DoHTTPstop();
                }
            }
            catch
            {
            }

            try
            {
                while (m_requests.TryTake(out req, 0))
                {
                    req.DoHTTPstop();
                }
            }
            catch
            {
            }
            m_requests.Dispose();
        }
        public void Stop()
        {
            IsRunning = false;
//            m_timeout = -10000; // cause all to expire
            Thread.Sleep(1000); // let the world move

            foreach (Thread t in m_workerThreads)
            {
                Watchdog.AbortThread(t.ManagedThreadId);
            }

            PollServiceHttpRequest wreq;

            if (m_longPollRequests.Count > 0 && IsRunning)
            {
                m_longPollRequests.ForEach(req => m_requests.Enqueue(req));
            }

            try
            {
                while (true)
                {
                    wreq = m_requests.Dequeue(0);
                    ResponsesProcessed++;
                    try
                    {
                        wreq.DoHTTPGruntWork(
                            m_server, wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id));
                    }
                    catch
                    {
                    }
                }
            }
            catch
            {
            }

            m_longPollRequests.Clear();
            m_requests.Clear();
        }
Example #13
0
        public void Close()
        {
            if (!m_Enabled)
            {
                return;
            }

            if (ProcessQueuedRequestsAsync)
            {
                if (m_NumberScenes <= 0 && m_workerThreads != null)
                {
                    m_log.DebugFormat("[WebFetchInvDescModule] Closing");
                    foreach (Thread t in m_workerThreads)
                    {
                        Watchdog.AbortThread(t.ManagedThreadId);
                    }

                    m_workerThreads = null;
                }
            }
        }