ptupitsyn commented on a change in pull request #7572: IGNITE-12835 Thin client: compute support URL: https://github.com/apache/ignite/pull/7572#discussion_r400813422
########## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/compute/ClientComputeTask.java ########## @@ -0,0 +1,166 @@ +/* + * 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.platform.client.compute; + +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.IgniteLogger; +import org.apache.ignite.cluster.ClusterNode; +import org.apache.ignite.internal.ComputeTaskInternalFuture; +import org.apache.ignite.internal.processors.platform.client.ClientCloseableResource; +import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext; +import org.apache.ignite.internal.processors.platform.client.ClientNotification; +import org.apache.ignite.internal.processors.platform.client.ClientObjectNotification; +import org.apache.ignite.internal.processors.platform.client.ClientStatus; +import org.apache.ignite.internal.processors.platform.client.IgniteClientException; +import org.apache.ignite.internal.processors.task.GridTaskProcessor; +import org.apache.ignite.internal.util.typedef.F; +import org.apache.ignite.lang.IgnitePredicate; + +import static org.apache.ignite.internal.processors.platform.client.ClientMessageParser.OP_COMPUTE_TASK_FINISHED; +import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_NO_FAILOVER; +import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_NO_RESULT_CACHE; +import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_SUBGRID_PREDICATE; +import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_SUBJ_ID; +import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_TIMEOUT; + +/** + * Client compute task. + */ +class ClientComputeTask implements ClientCloseableResource { + /** No failover flag mask. */ + private static final byte NO_FAILOVER_FLAG_MASK = 0x01; + + /** No result cache flag mask. */ + private static final byte NO_RESULT_CACHE_FLAG_MASK = 0x02; + + /** Context. */ + private final ClientConnectionContext ctx; + + /** Logger. */ + private final IgniteLogger log; + + /** Task id. */ + private volatile long taskId; + + /** Task future. */ + private volatile ComputeTaskInternalFuture<Object> taskFut; + + /** Task closed flag. */ + private final AtomicBoolean closed = new AtomicBoolean(); + + /** + * Ctor. + * + * @param ctx Connection context. + */ + ClientComputeTask(ClientConnectionContext ctx) { + assert ctx != null; + + this.ctx = ctx; + + log = ctx.kernalContext().log(getClass()); + } + + /** + * @param taskId Task ID. + * @param taskName Task name. + * @param arg Task arguments. + * @param nodeIds Nodes to run task jobs. + * @param flags Flags for task. + * @param timeout Task timeout. + */ + void execute(long taskId, String taskName, Object arg, Set<UUID> nodeIds, byte flags, long timeout) { + assert taskName != null; + + this.taskId = taskId; + + GridTaskProcessor task = ctx.kernalContext().task(); Review comment: Can you please explain the reason to use internal API instead of public `IgniteCompute`? ---------------------------------------------------------------- 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 With regards, Apache Git Services