Example #1
0
        public void startApp()
        {
            LOG.INFO("startApp");

            CRhoResourceMap.deployContent();
            RhoRuby.Init(m_webBrowser);

            DBAdapter.initAttrManager();

            LOG.INFO("Starting sync engine...");
            SyncThread sync = null;

            try{
                sync = SyncThread.Create();
            }catch (Exception exc) {
                LOG.ERROR("Create sync failed.", exc);
            }
            if (sync != null)
            {
                //sync.setStatusListener(this);
            }

            RhoRuby.InitApp();
            RhoRuby.call_config_conflicts();
            RHOCONF().conflictsResolved();
        }
Example #2
0
        public void Init(WebBrowser browser)
        {
            initAppUrls();
            RhoLogger.InitRhoLog();
            LOG.INFO("Init");

            CRhoFile.recursiveCreateDir(CFilePath.join(getBlobsDirPath(), " "));

            m_webBrowser = browser;
            m_httpServer = new CHttpServer(CFilePath.join(getRhoRootPath(), "apps"));
            CRhoResourceMap.deployContent();
            RhoRuby.Init(m_webBrowser);

            DBAdapter.initAttrManager();

            LOG.INFO("Starting sync engine...");
            SyncThread sync = null;

            try{
                sync = SyncThread.Create();
            }catch (Exception exc) {
                LOG.ERROR("Create sync failed.", exc);
            }
            if (sync != null)
            {
                //sync.setStatusListener(this);
            }

            RhoRuby.InitApp();
            RhoRuby.call_config_conflicts();
            RHOCONF().conflictsResolved();
        }
Example #3
0
        private void stopCounter(String szCounterName, boolean bDestroy)
        {
            CCounter pCounter = (CCounter)m_mapCounters.get(szCounterName);

            if (pCounter == null)
            {
                LOG.ERROR(szCounterName + " : Cannot find counter.");
                return;
            }

            if (bDestroy || !pCounter.isGlobal())
            {
                long oInterval = pCounter.stop();
                LOG.INFO(szCounterName + " (" + intervalToString(oInterval) + ") : STOP");

                m_mapCounters.remove(szCounterName);
            }
            else
            {
                pCounter.stop();
            }
        }
Example #4
0
        public override void run()
        {
            LOG.INFO("Starting main routine...");

            int nLastPollInterval = getLastPollInterval();

            while (!isStopping())
            {
                int nWait = m_nPollInterval > 0 ? m_nPollInterval : QUEUE_POLL_INTERVAL_INFINITE;

                if (m_nPollInterval > 0 && nLastPollInterval > 0)
                {
                    int nWait2 = m_nPollInterval - nLastPollInterval;
                    if (nWait2 <= 0)
                    {
                        nWait = QUEUE_STARTUP_INTERVAL_SECONDS;
                    }
                    else
                    {
                        nWait = nWait2;
                    }
                }

                lock (m_mxStackCommands)
                {
                    if (nWait >= 0 && !isStopping() && isNoCommands())
                    {
                        LOG.INFO("ThreadQueue blocked for " + nWait + " seconds...");
                        wait(nWait);

                        if (isNoCommands())
                        {
                            onTimeout();
                        }
                    }
                }
                nLastPollInterval = 0;

                if (!isStopping())
                {
                    try{
                        processCommands();
                    }catch (Exception e)
                    {
                        LOG.ERROR("processCommand failed", e);
                    }
                }
            }

            LOG.INFO("Thread shutdown");
        }
Example #5
0
        public virtual void stop(int nTimeoutToKill)
        {
            if (!isAlive())
            {
                return;
            }

            m_nState |= TS_STOPPING;
            stopWait();

            try{
                if (!m_thread.Join(nTimeoutToKill * 1000))
                {
                    m_thread.Abort();
                }
            }catch (Exception e) {
                LOG.ERROR("stop failed", e);
            }finally
            {
                m_nState &= ~TS_STOPPING;
            }
        }