Pochatkin commented on code in PR #3920:
URL: https://github.com/apache/ignite-3/pull/3920#discussion_r1639492881


##########
modules/compute/src/main/java/org/apache/ignite/internal/compute/state/InMemoryComputeStateMachine.java:
##########
@@ -139,6 +139,8 @@ private void changeJobState(UUID jobId, Function<JobState, 
JobState> newStateFun
             JobState currentState = currentStatus.state();
             JobState newState = newStateFunction.apply(currentState);
 
+            System.out.println("changeJobState currentState: " + currentState 
+ ", newState: " + newState);

Review Comment:
   Debug log?



##########
modules/compute/src/test/java/org/apache/ignite/internal/compute/loader/JobClassLoaderFactoryTest.java:
##########
@@ -90,8 +91,8 @@ public void unit1BothVersions() throws Exception {
 
             // and classes are loaded in the aplhabetical order
             ComputeJob<Integer> job1 = (ComputeJob<Integer>) 
unitJobClass.getDeclaredConstructor().newInstance();
-            Integer result1 = job1.execute(null);
-            assertEquals(1, result1);
+            CompletableFuture<Integer> result1 = job1.executeAsync(null);
+            assertEquals(1, result1.join());

Review Comment:
   assertThat(result1, willBe(1));



##########
modules/compute/src/test/java/org/apache/ignite/internal/compute/loader/JobClassLoaderFactoryTest.java:
##########
@@ -64,14 +65,14 @@ public void unit1() throws Exception {
             // then classes from the first unit are loaded from the first 
class loader
             Class<?> clazz1 = classLoader1.loadClass(UNIT_JOB_CLASS_NAME);
             ComputeJob<Integer> job1 = (ComputeJob<Integer>) 
clazz1.getDeclaredConstructor().newInstance();
-            Integer result1 = job1.execute(null);
-            assertEquals(1, result1);
+            CompletableFuture<Integer> result1 = job1.executeAsync(null);
+            assertEquals(1, result1.join());
 
             // and classes from the second unit are loaded from the second 
class loader
             Class<?> clazz2 = classLoader2.loadClass(UNIT_JOB_CLASS_NAME);
             ComputeJob<String> job2 = (ComputeJob<String>) 
clazz2.getDeclaredConstructor().newInstance();
-            String result2 = job2.execute(null);
-            assertEquals("Hello World!", result2);
+            CompletableFuture<String> result2 = job2.executeAsync(null);
+            assertEquals("Hello World!", result2.join());

Review Comment:
   assertThat(result2, willBe("Hello World!"));



##########
modules/api/src/main/java/org/apache/ignite/compute/ComputeJob.java:
##########
@@ -17,18 +17,22 @@
 
 package org.apache.ignite.compute;
 
+import java.util.concurrent.CompletableFuture;
+import org.jetbrains.annotations.Nullable;
+
 /**
  * A Compute job that may be executed on a single Ignite node, on several 
nodes, or on the entire cluster.
  *
  * @param <R> Job result type.
  */
+@SuppressWarnings("InterfaceMayBeAnnotatedFunctional")
 public interface ComputeJob<R> {
     /**
      * Executes the job on an Ignite node.
      *
      * @param context The execution context.
      * @param args Job arguments.
-     * @return Job result.
+     * @return Job future. Can be null if the job is synchronous and does not 
return any result.

Review Comment:
   Do we really want to have Nullable futute? Mby in this case user should have 
CF<Void> ?



##########
modules/compute/src/test/java/org/apache/ignite/internal/compute/loader/JobClassLoaderFactoryTest.java:
##########
@@ -64,14 +65,14 @@ public void unit1() throws Exception {
             // then classes from the first unit are loaded from the first 
class loader
             Class<?> clazz1 = classLoader1.loadClass(UNIT_JOB_CLASS_NAME);
             ComputeJob<Integer> job1 = (ComputeJob<Integer>) 
clazz1.getDeclaredConstructor().newInstance();
-            Integer result1 = job1.execute(null);
-            assertEquals(1, result1);
+            CompletableFuture<Integer> result1 = job1.executeAsync(null);
+            assertEquals(1, result1.join());

Review Comment:
   assertThat(result1, willBe(1));



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to