Class SliceAccessorImpl<A>
java.lang.Object
org.apache.jena.sparql.service.enhancer.impl.util.AutoCloseableBase
org.apache.jena.sparql.service.enhancer.impl.util.AutoCloseableWithLeakDetectionBase
org.apache.jena.sparql.service.enhancer.slice.impl.SliceAccessorImpl<A>
- Type Parameters:
A- The array type for transferring data in blocks
- All Implemented Interfaces:
AutoCloseable,SliceAccessor<A>
public class SliceAccessorImpl<A>
extends AutoCloseableWithLeakDetectionBase
implements SliceAccessor<A>
A sequence of claimed ranges within a certain range, whereas the range
can be modified resulting in an incremental change of the claims.
An individual page range should only be operated by a single thread though
multiple threads may each have their own page range.
- claimByOffsetRange() only triggers loading of the pages but does not wait for them to become ready
- lock() waits for all claimed pages to become ready and afterwards locks them
- unlock() must be called after lock(); unlocks all pages
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEvictionGuard(com.google.common.collect.RangeSet<Long> ranges) Adds an eviction guard (if the slice supports it) and binds its life cycle to this accessor.intblockingRead(A tgt, int tgtOffset, long srcOffset, int length) Method is subject to removal - use sequentialReaderForSlice.read The range [srcOffset, srcOffset + length) must be within the claimed range!voidclaimByOffsetRange(long startOffset, long endOffset) Set or update the claimed range - this will immediately request references to any pages providing the data for that range.getCache()com.google.common.collect.Range<Long>getSlice()voidlock()Lock the range for writingvoidReleases all currently held pages.voidvoidunlock()Unlock the rangeintunsafeRead(A tgt, int tgtOffset, long srcOffset, int length) Read a range of data - does not await any new datavoidPut a sequence of items into the claimed range Attempts to put items outside of the claimed range raises anIndexOutOfBoundsExceptionThe page range should be locked when calling this method.Methods inherited from class org.apache.jena.sparql.service.enhancer.impl.util.AutoCloseableWithLeakDetectionBase
getInstantiationStackTraceMethods inherited from class org.apache.jena.sparql.service.enhancer.impl.util.AutoCloseableBase
closeMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jena.sparql.service.enhancer.slice.api.SliceAccessor
addEvictionGuard, close
-
Constructor Details
-
SliceAccessorImpl
-
-
Method Details
-
getSlice
- Specified by:
getSlicein interfaceSliceAccessor<A>
-
getOffsetRange
-
getCache
-
getClaimedPages
-
claimByOffsetRange
public void claimByOffsetRange(long startOffset, long endOffset) Description copied from interface:SliceAccessorSet or update the claimed range - this will immediately request references to any pages providing the data for that range. Pages outside of that range are considered as no longer needed pages will immediately be released. This method prepares the pages which can be subsequently locked. Calling this method while the page range is locked (SliceAccessor.lock()) raises anIllegalStateException.- Specified by:
claimByOffsetRangein interfaceSliceAccessor<A>
-
lock
public void lock()Description copied from interface:SliceAccessorLock the range for writing- Specified by:
lockin interfaceSliceAccessor<A>
-
unlock
public void unlock()Description copied from interface:SliceAccessorUnlock the range- Specified by:
unlockin interfaceSliceAccessor<A>
-
releaseEvictionGuards
public void releaseEvictionGuards() -
releaseAll
public void releaseAll()Description copied from interface:SliceAccessorReleases all currently held pages. Future requests viaSliceAccessor.claimByOffsetRange(long, long)are allowed.- Specified by:
releaseAllin interfaceSliceAccessor<A>
-
write
Description copied from interface:SliceAccessorPut a sequence of items into the claimed range Attempts to put items outside of the claimed range raises anIndexOutOfBoundsExceptionThe page range should be locked when calling this method.- Specified by:
writein interfaceSliceAccessor<A>
-
unsafeRead
Read a range of data - does not await any new data- Specified by:
unsafeReadin interfaceSliceAccessor<A>- Throws:
IOException
-
blockingRead
Method is subject to removal - use sequentialReaderForSlice.read The range [srcOffset, srcOffset + length) must be within the claimed range!- Throws:
IOException
-
addEvictionGuard
Description copied from interface:SliceAccessorAdds an eviction guard (if the slice supports it) and binds its life cycle to this accessor. Closing an accessor thus also removes all eviction guards created by it. This method must be called after acquiring a read lock on the slice's metadata.- Specified by:
addEvictionGuardin interfaceSliceAccessor<A>- Parameters:
ranges- The set of ranges which to protected from eviction
-