Ejemplo n.º 1
0
        public TimerCollection Boot(string timerJsonPath)
        {
            if (!System.IO.File.Exists(timerJsonPath))
            {
                throw new System.IO.FileNotFoundException(timerJsonPath);
            }
            jsonTm = new JsonTimer(timerJsonPath);
            List <JsonTimerItem> listJTimer = jsonTm.Read();

            foreach (JsonTimerItem jtItem in listJTimer)
            {
                AnXTimer xTimer = new AnXTimer(jtItem);
                foreach (HandlerConfig hConfig in jtItem.Handlers)
                {
                    ITimerHandle tHandler = null;
                    if (xTimer.IsStrictTimer)
                    {
                        tHandler = new Impl.AsynPostHandlerImpl(hConfig);
                    }
                    else
                    {
                        tHandler = new Impl.SynPostHandlerImpl(hConfig);
                    }
                    xTimer.AddHandle(hConfig.Name, tHandler);
                }
                tc.Add(xTimer.Name, xTimer);
            }
            jsonTm.OnChange += jsonTm_OnChange;
            return(tc);
        }
Ejemplo n.º 2
0
        public ITimerHandle BuildHandler(bool isStrict, HandlerConfig hConfig)
        {
            ITimerHandle iT = null;

            if (isStrict)
            {
                iT = new Impl.AsynPostHandlerImpl(hConfig);
            }
            else
            {
                iT = new Impl.SynPostHandlerImpl(hConfig);
            }
            return(iT);
        }