Пример #1
0
        protected override void OnResume()
        {
            base.OnResume();

            new Task(() => DoUpdateTicker(true)).Start();

            updater = new ScheduledThreadPoolExecutor(1);
            updater.ScheduleAtFixedRate(() => DoUpdateTicker(false), 15, 15, TimeUnit.SECONDS);
        }
Пример #2
0
        private void ScheduleHistoryCleaner()
        {
            bool startCleanerService = conf.GetBoolean(JHAdminConfig.MrHistoryCleanerEnable,
                                                       true);

            if (startCleanerService)
            {
                cleanerInterval = conf.GetLong(JHAdminConfig.MrHistoryCleanerIntervalMs, JHAdminConfig
                                               .DefaultMrHistoryCleanerIntervalMs);
                futureHistoryCleaner = scheduledExecutor.ScheduleAtFixedRate(new JobHistory.HistoryCleaner
                                                                                 (this), GetInitDelaySecs() * 1000l, cleanerInterval, TimeUnit.Milliseconds);
            }
        }
Пример #3
0
 /// <exception cref="System.Exception"/>
 protected override void ServiceStart()
 {
     hsManager.Start();
     if (storage is Org.Apache.Hadoop.Service.Service)
     {
         ((Org.Apache.Hadoop.Service.Service)storage).Start();
     }
     scheduledExecutor = new ScheduledThreadPoolExecutor(2, new ThreadFactoryBuilder()
                                                         .SetNameFormat("Log Scanner/Cleaner #%d").Build());
     scheduledExecutor.ScheduleAtFixedRate(new JobHistory.MoveIntermediateToDoneRunnable
                                               (this), moveThreadInterval, moveThreadInterval, TimeUnit.Milliseconds);
     // Start historyCleaner
     ScheduleHistoryCleaner();
     base.ServiceStart();
 }
Пример #4
0
     public void TestRateThreaded() {
 
         var config = new Configuration();
         config.AddEventType<SupportBean>();
         epService = EPServiceProviderManager.GetDefaultProvider(config);
         epService.Initialize();
 
         var runnable = new RateSendRunnable(epService.EPRuntime);
         var timer = new ScheduledThreadPoolExecutor(1);
 
         //string viewExpr = "select RATE(LongPrimitive) as myrate from SupportBean#time(10) output every 1 sec";
         var viewExpr = "select RATE(10) as myrate from SupportBean output snapshot every 1 sec";
         var stmt = epService.EPAdministrator.CreateEPL(viewExpr);
         stmt.Events += (sender, args) => Log.Info(newEvents[0].Get("myrate"));
 
         var rateDelay = 133;   // <== change here
         var future = timer.ScheduleAtFixedRate(runnable, 0, rateDelay, TimeUnit.MILLISECONDS);
         System.Threading.Thread.Sleep(2 * 60 * 1000);
         future.Cancel(true);
     }