Package org.apache.druid.segment.loading
Class RoundRobinStorageLocationSelectorStrategy
- java.lang.Object
-
- org.apache.druid.segment.loading.RoundRobinStorageLocationSelectorStrategy
-
- All Implemented Interfaces:
StorageLocationSelectorStrategy
public class RoundRobinStorageLocationSelectorStrategy extends Object implements StorageLocationSelectorStrategy
AStorageLocationselector strategy that selects a segment cache location in a round-robin fashion each time among the available storage locations. WhenIterator.next()on iterator retuned bygetLocations()is called the locations are returned in a round robin fashion even when multiple threads are in use.
-
-
Constructor Summary
Constructors Constructor Description RoundRobinStorageLocationSelectorStrategy(List<StorageLocation> storageLocations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<StorageLocation>getLocations()Finds the best ordering of theStorageLocations to load aDataSegmentaccording to the location selector strategy.
-
-
-
Constructor Detail
-
RoundRobinStorageLocationSelectorStrategy
public RoundRobinStorageLocationSelectorStrategy(List<StorageLocation> storageLocations)
-
-
Method Detail
-
getLocations
public Iterator<StorageLocation> getLocations()
Description copied from interface:StorageLocationSelectorStrategyFinds the best ordering of theStorageLocations to load aDataSegmentaccording to the location selector strategy. This method returns an iterator instead of a single best location. The caller is responsible for iterating over the locations and callingStorageLocation.reserve(java.lang.String, org.apache.druid.timeline.DataSegment)method. This is because a single location may be problematic like failed disk or might become unwritable for whatever reasons. This method can be called by different threads and so should be thread-safe.- Specified by:
getLocationsin interfaceStorageLocationSelectorStrategy- Returns:
- An iterator of
StorageLocations from which the callers can iterate and pick a location.
-
-