Exemple #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public SingleFilePageSwapper(java.io.File file, org.neo4j.io.fs.FileSystemAbstraction fs, int filePageSize, org.neo4j.io.pagecache.PageEvictionCallback onEviction, boolean noChannelStriping) throws java.io.IOException
        public SingleFilePageSwapper(File file, FileSystemAbstraction fs, int filePageSize, PageEvictionCallback onEviction, bool noChannelStriping)
        {
            this._fs   = fs;
            this._file = file;
            if (noChannelStriping)
            {
                this._channelStripeCount = 1;
                this._channelStripeMask  = StripeMask(_channelStripeCount);
            }
            else
            {
                this._channelStripeCount = _globalChannelStripeCount;
                this._channelStripeMask  = _globalChannelStripeMask;
            }
            this._channels = new StoreChannel[_channelStripeCount];
            for (int i = 0; i < _channelStripeCount; i++)
            {
                _channels[i] = fs.Open(file, OpenMode.READ_WRITE);
            }
            this._filePageSize = filePageSize;
            this._onEviction   = onEviction;
            IncreaseFileSizeTo(_channels[TOKEN_CHANNEL_STRIPE].size());

            try
            {
                AcquireLock();
            }
            catch (IOException e)
            {
                CloseAndCollectExceptions(0, e);
            }
            _hasPositionLock = _channels[0].GetType() == typeof(StoreFileChannel) && StoreFileChannelUnwrapper.unwrap(_channels[0]).GetType() == typeof(FileChannelImpl);
        }
Exemple #2
0
        public override void Evicted(long filePageId)
        {
            PageEvictionCallback callback = this._onEviction;

            if (callback != null)
            {
                callback.OnEvict(filePageId);
            }
        }
Exemple #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.io.pagecache.PageSwapper createPageSwapper(java.io.File file, int filePageSize, org.neo4j.io.pagecache.PageEvictionCallback onEviction, boolean createIfNotExist, boolean noChannelStriping) throws java.io.IOException
        public override PageSwapper CreatePageSwapper(File file, int filePageSize, PageEvictionCallback onEviction, bool createIfNotExist, bool noChannelStriping)
        {
            if (!_fs.fileExists(file))
            {
                if (createIfNotExist)
                {
                    _fs.create(file).close();
                }
                else
                {
                    throw new NoSuchFileException(file.Path, null, "Cannot map non-existing file");
                }
            }
            return(new SingleFilePageSwapper(file, _fs, filePageSize, onEviction, noChannelStriping));
        }
Exemple #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public synchronized void close() throws java.io.IOException
        public override void Close()
        {
            lock (this)
            {
                _closed = true;
                try
                {
                    CloseAndCollectExceptions(0, null);
                }
                finally
                {
                    // Eagerly relinquish our reference to the onEviction callback, because even though
                    // we've closed the PagedFile at this point, there are likely still pages in the cache that are bound to
                    // this swapper, and will stay bound, until the eviction threads eventually gets around to kicking them out.
                    // It is especially important to null out the onEviction callback field, because it is in turn holding on to
                    // the striped translation table, which can be a rather large structure.
                    _onEviction = null;
                }
            }
        }
Exemple #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.io.pagecache.PageSwapper createPageSwapper(java.io.File file, int filePageSize, org.neo4j.io.pagecache.PageEvictionCallback onEviction, boolean createIfNotExist, boolean noChannelStriping) throws java.io.IOException
            public override PageSwapper CreatePageSwapper(File file, int filePageSize, PageEvictionCallback onEviction, bool createIfNotExist, bool noChannelStriping)
            {
                // This will be called early in the startup sequence. Notifies that we can call stop on the server.
                _semaphore.release();
                return(base.CreatePageSwapper(file, filePageSize, onEviction, createIfNotExist, noChannelStriping));
            }