Package org.apache.accumulo.core.client
Interface BatchScanner
- All Superinterfaces:
- AutoCloseable,- Iterable<Map.Entry<Key,,- Value>> - ScannerBase
In exchange for possibly returning scanned entries out of order, BatchScanner
 implementations may scan an Accumulo table more efficiently by
 
- Looking up multiple ranges in parallel. Parallelism is constrained by the number of threads available to the BatchScanner, set in its constructor.
- Breaking up large ranges into subranges. Often the number and boundaries of subranges are determined by a table's split points.
- Combining multiple ranges into a single RPC call to a tablet server.
Scanner in use cases such as
 - Retrieving many small ranges
- Scanning a large range that returns many entries
- Running server-side iterators that perform computation, even if few entries are returned from the scan itself
Scanner instead when sorted order is important.
 
 A BatchScanner instance will use no more threads than provided in the construction of the
 BatchScanner implementation. Multiple invocations of iterator() will all share the
 same resources of the instance. A new BatchScanner instance should be created to use allocate
 additional threads.
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.accumulo.core.client.ScannerBaseScannerBase.ConsistencyLevel
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes any underlying connections on the scanner.voidsetRanges(Collection<Range> ranges) Allows scanning over multiple ranges efficiently.voidsetTimeout(long timeout, TimeUnit timeUnit) This setting determines how long a scanner will automatically retry when a failure occurs.Methods inherited from interface java.lang.IterableforEach, spliteratorMethods inherited from interface org.apache.accumulo.core.client.ScannerBaseaddScanIterator, clearClassLoaderContext, clearColumns, clearSamplerConfiguration, clearScanIterators, fetchColumn, fetchColumn, fetchColumn, fetchColumnFamily, fetchColumnFamily, forEach, getAuthorizations, getBatchTimeout, getClassLoaderContext, getConsistencyLevel, getSamplerConfiguration, getTimeout, iterator, removeScanIterator, setBatchTimeout, setClassLoaderContext, setConsistencyLevel, setExecutionHints, setSamplerConfiguration, stream, updateScanIteratorOption
- 
Method Details- 
setRangesAllows scanning over multiple ranges efficiently.- Parameters:
- ranges- specifies the non-overlapping ranges to query
 
- 
closevoid close()Description copied from interface:ScannerBaseCloses any underlying connections on the scanner. This may invalidate any iterators derived from the Scanner, causing them to throw exceptions.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- ScannerBase
 
- 
setTimeoutThis setting determines how long a scanner will automatically retry when a failure occurs. By default, a scanner will retry forever.Setting the timeout to zero (with any time unit) or Long.MAX_VALUE(withTimeUnit.MILLISECONDS) means no timeout.The batch scanner will accomplish as much work as possible before throwing an exception. BatchScanner iterators will throw a TimedOutExceptionwhen all needed servers timeout.- Specified by:
- setTimeoutin interface- ScannerBase
- Parameters:
- timeout- the length of the timeout
- timeUnit- the units of the timeout
 
 
-