//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldNotTimeoutSchemaTransactions()
        internal virtual void ShouldNotTimeoutSchemaTransactions()
        {
            // given
            KernelTransactions       kernelTransactions = mock(typeof(KernelTransactions));
            FakeClock                clock   = new FakeClock(100, MINUTES);
            KernelTransactionMonitor monitor = new KernelTransactionMonitor(kernelTransactions, clock, NullLogService.Instance);
            // a 2 minutes old schema transaction which has a timeout of 1 minute
            KernelTransactionHandle oldSchemaTransaction = mock(typeof(KernelTransactionHandle));

            when(oldSchemaTransaction.SchemaTransaction).thenReturn(true);
            when(oldSchemaTransaction.StartTime()).thenReturn(clock.Millis() - MINUTES.toMillis(2));
            when(oldSchemaTransaction.TimeoutMillis()).thenReturn(MINUTES.toMillis(1));
            when(kernelTransactions.ActiveTransactions()).thenReturn(Iterators.asSet(oldSchemaTransaction));

            // when
            monitor.Run();

            // then
            verify(oldSchemaTransaction, times(1)).SchemaTransaction;
            verify(oldSchemaTransaction, never()).markForTermination(any());
        }
Ejemplo n.º 2
0
 public KernelTransactionMonitorScheduler(KernelTransactionMonitor kernelTransactionMonitor, JobScheduler scheduler, long checkIntervalMillis)
 {
     this._kernelTransactionMonitor = kernelTransactionMonitor;
     this._scheduler           = scheduler;
     this._checkIntervalMillis = checkIntervalMillis;
 }