예제 #1
0
        internal Host()
        {
            Logger.Instance.Info("Setting up all the services...");
            Logger.Instance.Info("Setting up DB Writer Proxy service...");

            ReaderThreads = new SmartThreadPool();
            Logger.Instance.Info("Setting up Reader services...");
            TimerState ts = new TimerState();

            timer = new IntervalHandler(ts, ReaderThreads);
            Logger.Instance.Info("initialized timer");

            GC.KeepAlive(timer);
            Logger.Instance.Info("told that GC to ignore timer object");

            _service = new ServiceHost<ReaderService>(new Uri[] { });
            games = Games.Instance.GetMonitoredGames();
        }
        public void SetEventCallbacks(IntervalHandler timer, List<GameMonitoringConfig> games, QueueManager WorkQueue)
        {
            //interval timer events
            //+= to add a new event delegate to fire on the appropriate timer

            //one
            timer.OneMinute += new IntervalHandler.IntervalHandlerDelegate(UserActivitycheck);
            timer.OneMinute += new IntervalHandler.IntervalHandlerDelegate(HostingInstanceCheck);
            timer.OneMinute += new IntervalHandler.IntervalHandlerDelegate(GameSessionActivityCheck);
            timer.OneMinute += new IntervalHandler.IntervalHandlerDelegate(RunTransactionReport);
            timer.OneMinute += new IntervalHandler.IntervalHandlerDelegate(ScrapeUserData);
            //five
            timer.FiveMinutes += new IntervalHandler.IntervalHandlerDelegate(OnInterval);

            //fifteen
            timer.FifteenMinutes += new IntervalHandler.IntervalHandlerDelegate(OnInterval);
            //timer.FifteenMinutes += new IntervalHandler.IntervalHandlerDelegate(ProcessRetention);

            //thirty
            timer.ThirtyMinutes += new IntervalHandler.IntervalHandlerDelegate(OnInterval);

            //one hour
            timer.SixtyMinutes += new IntervalHandler.IntervalHandlerDelegate(OnInterval);

            //six hours
            timer.SixHours += new IntervalHandler.IntervalHandlerDelegate(OnInterval);

            //twelve
            timer.TwelveHours += new IntervalHandler.IntervalHandlerDelegate(OnInterval);
            timer.TwelveHours += new IntervalHandler.IntervalHandlerDelegate(DailyStats);

            //daily
            timer.TwentyFourHours += new IntervalHandler.IntervalHandlerDelegate(OnInterval);
            timer.TwentyFourHours += new IntervalHandler.IntervalHandlerDelegate(ProcessRetention);

            Logger.Instance.Info("set event callbacks");
        }
예제 #3
0
 static void StopInterval(IntervalHandler handler, int timeInfo)
 {
     //timesExecuted++;
     //if (Moniverse.hasError || timesExecuted > 0)
     //{
     handler.stop();
     Console.ForegroundColor = System.ConsoleColor.Yellow;
     Console.WriteLine("===============Done==============");
     Console.ForegroundColor = System.ConsoleColor.Gray;
     //}
 }
예제 #4
0
        static void RunInterval(MockTimerState ts)
        {
            IntervalHandler timer = new IntervalHandler(ts, ConsoleThreads);

            Console.WriteLine("initialized timer");
            GC.KeepAlive(timer);
            Console.WriteLine("tell GC to ignore timer object");
            List<GameMonitoringConfig> games = Games.Instance.GetMonitoredGames();

            //one
            timer.OneMinute += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.UserActivitycheck);
            timer.OneMinute += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.HostingInstanceCheck);
            timer.OneMinute += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.GameSessionActivityCheck);
            timer.OneMinute += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.RunTransactionReport);
            //five
            timer.FiveMinutes += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.OnInterval);
            //fifteen
            timer.FifteenMinutes += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.OnInterval);
            //timer.FifteenMinutes += new IntervalHandler.IntervalHandlerDelegate(ProcessRetention);
            //thirty
            timer.ThirtyMinutes += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.OnInterval);

            //one hour
            timer.SixtyMinutes += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.OnInterval);
            timer.SixtyMinutes += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.ScrapeUserData);

            //six hours
            timer.SixHours += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.OnInterval);

            //twelve
            timer.TwelveHours += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.OnInterval);

            //daily
            timer.TwentyFourHours += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.OnInterval);
            timer.TwentyFourHours += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.RunTransactionReport);
            timer.TwentyFourHours += new IntervalHandler.IntervalHandlerDelegate(MonitoringEvents.ProcessRetention);
            Console.WriteLine("set event callbacks");

            timer.OnCheck += new IntervalHandler.OnCheckDelegate(StopInterval);

            //long timeToWait = 60000;
            long timeToWait = 1000;

            long WaitTillWholeMin = 0; //this is telling this guy to wait until the next whoe minute (:00 seconds)
            Console.WriteLine("Waiting till the next whole minute to start the Timer");
            //run the time at what interval
            timer.run((long)timeToWait, WaitTillWholeMin, games); ///60 seconds // 1 minute == 60000
            ///
            //Thread.Sleep(30000);
        }