public class QueryRunner extends Object
Used by query operations only: QueryOperation & QueryPartitionOperation Should not be used by proxies or any other query related objects.
Modifier and Type | Field and Description |
---|---|
protected ClusterService |
clusterService |
protected LocalMapStatsProvider |
localMapStatsProvider |
protected ILogger |
logger |
protected MapServiceContext |
mapServiceContext |
protected NodeEngine |
nodeEngine |
protected OperationService |
operationService |
protected PartitionScanExecutor |
partitionScanExecutor |
protected IPartitionService |
partitionService |
protected QueryOptimizer |
queryOptimizer |
protected QueryResultSizeLimiter |
queryResultSizeLimiter |
protected ResultProcessorRegistry |
resultProcessorRegistry |
protected InternalSerializationService |
serializationService |
Constructor and Description |
---|
QueryRunner(MapServiceContext mapServiceContext,
QueryOptimizer optimizer,
PartitionScanExecutor partitionScanExecutor,
ResultProcessorRegistry resultProcessorRegistry) |
Modifier and Type | Method and Description |
---|---|
protected Collection<QueryableEntry> |
doRunUsingPartitionScanOnSinglePartition(String mapName,
Predicate originalPredicate,
int partitionId) |
protected boolean |
hasOwnerMigrationsInFlight()
Check whether migrations of owner partition are currently executed.
|
protected boolean |
hasPartitionStateVersionChanged(int initialPartitionStateVersion)
Check whether partition state version has changed since
initialPartitionStateVersion . |
protected boolean |
hasPartitionVersion(int expectedVersion,
Predicate predicate) |
protected boolean |
isResultSafe(int initialPartitionStateVersion)
Check whether results obtained since partition state version was at
initialPartitionStateVersion are safe
to be returned to the caller. |
protected Result |
populateTheResult(Query query,
Collection<QueryableEntry> entries,
Collection<Integer> initialPartitions) |
Result |
run(Query query) |
protected Collection<QueryableEntry> |
runUsingIndex(Predicate predicate,
MapContainer mapContainer) |
protected Collection<QueryableEntry> |
runUsingIndexSafely(Predicate predicate,
MapContainer mapContainer,
int initialPartitionStateVersion) |
Result |
runUsingPartitionScanOnSinglePartition(Query query,
int partitionId) |
protected Collection<QueryableEntry> |
runUsingPartitionScanSafely(String name,
Predicate predicate,
Collection<Integer> partitions,
int initialPartitionStateVersion) |
protected void |
updateStatistics(MapContainer mapContainer) |
protected final MapServiceContext mapServiceContext
protected final NodeEngine nodeEngine
protected final ILogger logger
protected final QueryResultSizeLimiter queryResultSizeLimiter
protected final InternalSerializationService serializationService
protected final IPartitionService partitionService
protected final QueryOptimizer queryOptimizer
protected final OperationService operationService
protected final ClusterService clusterService
protected final LocalMapStatsProvider localMapStatsProvider
protected final PartitionScanExecutor partitionScanExecutor
protected final ResultProcessorRegistry resultProcessorRegistry
public QueryRunner(MapServiceContext mapServiceContext, QueryOptimizer optimizer, PartitionScanExecutor partitionScanExecutor, ResultProcessorRegistry resultProcessorRegistry)
public Result run(Query query) throws ExecutionException, InterruptedException
protected Result populateTheResult(Query query, Collection<QueryableEntry> entries, Collection<Integer> initialPartitions)
protected Collection<QueryableEntry> runUsingIndexSafely(Predicate predicate, MapContainer mapContainer, int initialPartitionStateVersion)
protected Collection<QueryableEntry> runUsingIndex(Predicate predicate, MapContainer mapContainer)
protected Collection<QueryableEntry> runUsingPartitionScanSafely(String name, Predicate predicate, Collection<Integer> partitions, int initialPartitionStateVersion) throws InterruptedException, ExecutionException
public Result runUsingPartitionScanOnSinglePartition(Query query, int partitionId) throws ExecutionException, InterruptedException
protected Collection<QueryableEntry> doRunUsingPartitionScanOnSinglePartition(String mapName, Predicate originalPredicate, int partitionId) throws ExecutionException, InterruptedException
protected boolean hasOwnerMigrationsInFlight()
true
if owner partition migrations are currently being executed, otherwise false.CountingMigrationAwareService
protected boolean hasPartitionStateVersionChanged(int initialPartitionStateVersion)
initialPartitionStateVersion
.initialPartitionStateVersion
- the initial partition state version to compare againsttrue
if current partition state version is not equal to initialPartitionStateVersion
protected boolean isResultSafe(int initialPartitionStateVersion)
initialPartitionStateVersion
are safe
to be returned to the caller. Effectively this method checks:
initialPartitionStateVersion
- true
if no owner migrations are currently executing and initialPartitionStateVersion
is
the same as the current partition state version, otherwise false
.protected boolean hasPartitionVersion(int expectedVersion, Predicate predicate)
protected void updateStatistics(MapContainer mapContainer)
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.