예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(timeout = 10_000) public void shouldWaitForCompletionInHalt() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldWaitForCompletionInHalt()
        {
            // GIVEN
            PageCache pageCache = mock(typeof(PageCache));

            Org.Neo4j.Test.Barrier_Control barrier = new Org.Neo4j.Test.Barrier_Control();
            doAnswer(invocation =>
            {
                barrier.Reached();
                return(null);
            }).when(pageCache).flushAndForce();
            PageCacheFlusher flusher = new PageCacheFlusher(pageCache);

            flusher.Start();

            // WHEN
            barrier.Await();
            Future <object> halt = T2.execute(state =>
            {
                flusher.Halt();
                return(null);
            });

            T2.get().waitUntilWaiting(details => details.isAt(typeof(PageCacheFlusher), "halt"));
            barrier.Release();

            // THEN halt call exits normally after (confirmed) ongoing flushAndForce call completed.
            halt.get();
        }
예제 #2
0
 public virtual void StartFlushingPageCache()
 {
     if (_importConfiguration.sequentialBackgroundFlushing())
     {
         if (_flusher != null)
         {
             throw new System.InvalidOperationException("Flusher already started");
         }
         _flusher = new PageCacheFlusher(_pageCache);
         _flusher.Start();
     }
 }