/// <summary> /// Channels must be closed when no longer used, so that they are released back to the pool of readers. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: org.neo4j.cursor.IOCursor<org.neo4j.causalclustering.core.consensus.log.EntryRecord> getCursor(long logIndex) throws java.io.IOException, DisposedException internal virtual IOCursor <EntryRecord> GetCursor(long logIndex) { Debug.Assert(logIndex > _header.prevIndex()); if (!_refCount.increase()) { throw new DisposedException(); } /* This is the relative index within the file, starting from zero. */ long offsetIndex = logIndex - (_header.prevIndex() + 1); LogPosition position = _positionCache.lookup(offsetIndex); Reader reader = _readerPool.acquire(_version, position.ByteOffset); try { long currentIndex = position.LogIndex; return(new EntryRecordCursor(reader, _contentMarshal, currentIndex, offsetIndex, this)); } catch (EndOfStreamException) { _readerPool.release(reader); _refCount.decrease(); return(IOCursor.Empty); } catch (IOException e) { reader.Dispose(); _refCount.decrease(); throw e; } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnSaneDefaultPosition() public virtual void ShouldReturnSaneDefaultPosition() { // when LogPosition position = _cache.lookup(5); // then assertEquals(_beginning, position); }