예제 #1
0
 public override void Start()
 {
     if (_checkIntervalMillis > 0)
     {
         _monitorJobHandle = _scheduler.scheduleRecurring(Group.TRANSACTION_TIMEOUT_MONITOR, _kernelTransactionMonitor, _checkIntervalMillis, TimeUnit.MILLISECONDS);
     }
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void startJobTransactionMonitor()
        internal virtual void StartJobTransactionMonitor()
        {
            JobHandle jobHandle = Mockito.mock(typeof(JobHandle));

            when(_jobScheduler.scheduleRecurring(eq(Group.TRANSACTION_TIMEOUT_MONITOR), eq(_transactionMonitor), anyLong(), any(typeof(TimeUnit)))).thenReturn(jobHandle);

            KernelTransactionMonitorScheduler monitorScheduler = new KernelTransactionMonitorScheduler(_transactionMonitor, _jobScheduler, 7);

            monitorScheduler.Start();
            verify(_jobScheduler).scheduleRecurring(Group.TRANSACTION_TIMEOUT_MONITOR, _transactionMonitor, 7, TimeUnit.MILLISECONDS);

            monitorScheduler.Stop();
            verify(jobHandle).cancel(true);
        }
예제 #3
0
 public override void Init()
 {
     if (_pullIntervalMillis > 0)
     {
         _intervalJobHandle = _scheduler.scheduleRecurring(Group.PULL_UPDATES, () =>
         {
             try
             {
                 _updatePuller.pullUpdates();
             }
             catch (InterruptedException e)
             {
                 _log.error("Pull updates failed", e);
             }
         }, _pullIntervalMillis, _pullIntervalMillis, TimeUnit.MILLISECONDS);
     }
 }
예제 #4
0
        public virtual Optional <JobHandle> ScheduleDownload(CatchupAddressProvider addressProvider)
        {
            lock (this)
            {
                if (_stopped)
                {
                    return(null);
                }

                if (_currentJob == null || _currentJob.hasCompleted())
                {
                    _currentJob = new PersistentSnapshotDownloader(addressProvider, _applicationProcess, _downloader, _log, _downloaderPauseStrategy, _dbHealth, _monitors);
                    _jobHandle  = _jobScheduler.schedule(Group.DOWNLOAD_SNAPSHOT, _currentJob);
                    return(_jobHandle);
                }
                return(_jobHandle);
            }
        }
예제 #5
0
 public override void Start()
 {
     _jobHandle = _scheduler.scheduleRecurring(Group.STORAGE_MAINTENANCE, this.maintenance, 1, TimeUnit.SECONDS);
 }