timoninmaxim commented on a change in pull request #9081: URL: https://github.com/apache/ignite/pull/9081#discussion_r637840435
########## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryResultFetcher.java ########## @@ -0,0 +1,243 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.query; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.UUID; +import java.util.concurrent.ConcurrentMap; +import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.IgniteLogger; +import org.apache.ignite.cluster.ClusterNode; +import org.apache.ignite.internal.managers.communication.GridIoPolicy; +import org.apache.ignite.internal.processors.cache.GridCacheContext; +import org.apache.ignite.internal.util.typedef.F; +import org.apache.ignite.internal.util.typedef.internal.U; + +/** + * This class is responsible for sending request for query result pages to remote nodes. + */ +public abstract class CacheQueryResultFetcher { + /** + * Map (requestId -> query future) where request id is unique for all requests per query. + * This map is populated by query manager. + */ + private final ConcurrentMap<Long, GridCacheDistributedQueryFuture<?, ?, ?>> qryFuts; + + /** Cache context. */ + private final GridCacheContext cctx; + + /** Ignite logger. */ + private final IgniteLogger log; + + /** */ + CacheQueryResultFetcher( + final GridCacheContext cctx, + final ConcurrentMap<Long, GridCacheDistributedQueryFuture<?, ?, ?>> qryFuts) { Review comment: Agree, that the "fetcher" name isn't good. I think it's much as Trigger or Requester. Moment to load page is depends on reducer implementation, so reducer is responsible for triggering pages. Reducer is created per request, and fetcher is single per Cache, so we can hold a reference with the same lifecycle. Alternative is to store a future in reducer (and we can do it, as get fut in constructor), and provide it to fetcher instead of reqId. Also it help us to get rid of query qryFuts. Looks OK for me. I'll do this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org