Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void mustCountFlushes()
        internal virtual void MustCountFlushes()
        {
            using (MajorFlushEvent cacheFlush = _tracer.beginCacheFlush())
            {
                cacheFlush.FlushEventOpportunity().beginFlush(0, 0, _swapper).done();
                cacheFlush.FlushEventOpportunity().beginFlush(0, 0, _swapper).done();
                cacheFlush.FlushEventOpportunity().beginFlush(0, 0, _swapper).done();
            }

            AssertCounts(0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0d);

            using (MajorFlushEvent fileFlush = _tracer.beginFileFlush(_swapper))
            {
                fileFlush.FlushEventOpportunity().beginFlush(0, 0, _swapper).done();
                fileFlush.FlushEventOpportunity().beginFlush(0, 0, _swapper).done();
                fileFlush.FlushEventOpportunity().beginFlush(0, 0, _swapper).done();
            }

            AssertCounts(0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0d);
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void flushAndForce(org.neo4j.io.pagecache.IOLimiter limiter) throws java.io.IOException
        public override void FlushAndForce(IOLimiter limiter)
        {
            if (limiter == null)
            {
                throw new System.ArgumentException("IOLimiter cannot be null");
            }
            IList <PagedFile> files = ListExistingMappings();

            using (MajorFlushEvent ignored = _pageCacheTracer.beginCacheFlush())
            {
                if (limiter.Limited)
                {
                    FlushAllPages(files, limiter);
                }
                else
                {
                    FlushAllPagesParallel(files, limiter);
                }
                SyncDevice();
            }
            ClearEvictorException();
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void flushFile(MuninnPagedFile muninnPagedFile, org.neo4j.io.pagecache.IOLimiter limiter) throws java.io.IOException
        private void FlushFile(MuninnPagedFile muninnPagedFile, IOLimiter limiter)
        {
            try
            {
                using (MajorFlushEvent fileFlush = _pageCacheTracer.beginFileFlush(muninnPagedFile.Swapper))
                {
                    FlushEventOpportunity flushOpportunity = fileFlush.FlushEventOpportunity();
                    muninnPagedFile.FlushAndForceInternal(flushOpportunity, false, limiter);
                }
            }
            catch (ClosedChannelException e)
            {
                if (muninnPagedFile.RefCount > 0)
                {
                    // The file is not supposed to be closed, since we have a positive ref-count, yet we got a
                    // ClosedChannelException anyway? It's an odd situation, so let's tell the outside world about
                    // this failure.
                    throw e;
                }
                // Otherwise: The file was closed while we were trying to flush it. Since unmapping implies a flush
                // anyway, we can safely assume that this is not a problem. The file was flushed, and it doesn't
                // really matter how that happened. We'll ignore this exception.
            }
        }