Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void evict(long pageRef, org.neo4j.io.pagecache.tracing.EvictionEvent evictionEvent) throws java.io.IOException
        private void Evict(long pageRef, EvictionEvent evictionEvent)
        {
            long filePageId = GetFilePageId(pageRef);

            evictionEvent.FilePageId  = filePageId;
            evictionEvent.CachePageId = pageRef;
            int swapperId = GetSwapperId(pageRef);

            if (swapperId != 0)
            {
                // If the swapper id is non-zero, then the page was not only loaded, but also bound, and possibly modified.
                SwapperSet.SwapperMapping swapperMapping = _swappers.getAllocation(swapperId);
                if (swapperMapping != null)
                {
                    // The allocation can be null if the file has been unmapped, but there are still pages
                    // lingering in the cache that were bound to file page in that file.
                    PageSwapper swapper = swapperMapping.Swapper;
                    evictionEvent.Swapper = swapper;

                    if (IsModified(pageRef))
                    {
                        FlushModifiedPage(pageRef, evictionEvent, filePageId, swapper);
                    }
                    swapper.Evicted(filePageId);
                }
            }
            ClearBinding(pageRef);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void mustReturnAllocationWithSwapper()
        internal virtual void MustReturnAllocationWithSwapper()
        {
            DummyPageSwapper a = new DummyPageSwapper("a", 42);
            DummyPageSwapper b = new DummyPageSwapper("b", 43);
            int idA            = _set.allocate(a);
            int idB            = _set.allocate(b);

            SwapperSet.SwapperMapping allocA = _set.getAllocation(idA);
            SwapperSet.SwapperMapping allocB = _set.getAllocation(idB);
            assertThat(allocA.Swapper, @is(a));
            assertThat(allocB.Swapper, @is(b));
        }