[Java] Support parallel actor in experimental. (#21701)

For the purpose to provide an alternative option for running multiple actor instances in a Java worker process, and the eventual goal is to remove the original multi-worker-instances in one worker process implementation.  we're proposing supporting parallel actor concept in Java. This feature enables that users could define some homogeneous parallel execution instances in an actor, and all instances hold one thread as the execution backend.

### Introduction

For the following example, we define a parallel actor with  10 parallelism. The backend actor has 10 concurrency groups for the parallel executions, it also means there're 10 threads for that.

We can access the instance by the instance handle, like:
```java
ParallelActorHandle<A> actor = ParallelActor.actor(A::new).setParallelism(10).remote();
ParallelInstance<A> instance = actor.getInstance(/*index=*/ 2);
Preconditions.checkNotNull(instance);
Ray.get(instance.task(A::incr, 1000000).remote()); // print 1000000           

instance = actor.getInstance(/*index=*/ 2);
Preconditions.checkNotNull(instance);
Ray.get(instance.task(A::incr, 2000000).remote().get()); // print 3000000

instance = actor.getInstance(/*index=*/ 3);
Preconditions.checkNotNull(instance);
Ray.get(instance.task(A::incr, 2000000).remote().get()); // print 2000000
```


### Limitation
- It doesn't support concurrency group on a parallel actor yet.

Co-authored-by: Kai Yang <kfstorm@outlook.com>
This commit is contained in:
Qing Wang 2022-04-21 22:54:33 +08:00 committed by GitHub
parent f376dd8902
commit c5252c5ceb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 2060 additions and 2 deletions

View file

@ -0,0 +1,664 @@
// Generated by `RayCallGenerator.java`. DO NOT EDIT.
package io.ray.api.parallelactor;
import io.ray.api.ObjectRef;
import io.ray.api.function.RayFuncVoid;
import io.ray.api.function.RayFuncR;
import io.ray.api.function.RayFunc1;
import io.ray.api.function.RayFunc2;
import io.ray.api.function.RayFunc3;
import io.ray.api.function.RayFunc4;
import io.ray.api.function.RayFunc5;
import io.ray.api.function.RayFunc6;
import io.ray.api.function.RayFuncVoid1;
import io.ray.api.function.RayFuncVoid2;
import io.ray.api.function.RayFuncVoid3;
import io.ray.api.function.RayFuncVoid4;
import io.ray.api.function.RayFuncVoid5;
import io.ray.api.function.RayFuncVoid6;
/**
* This class provides type-safe interfaces for remote actor calls.
**/
interface ActorCall<A> {
default VoidParallelActorTaskCaller buildVoidReturnCaller(RayFuncVoid func, Object[] args) {
return new VoidParallelActorTaskCaller((ParallelActorInstance) this, func, args);
}
default <R> ParallelActorTaskCaller<R> buildCaller(RayFuncR<R> func, Object[] args) {
return new ParallelActorTaskCaller<R>((ParallelActorInstance) this, func, args);
}
default <R> ParallelActorTaskCaller<R> task(RayFunc1<A, R> f) {
Object[] args = new Object[] {};
return buildCaller(f, args);
}
default VoidParallelActorTaskCaller task(RayFuncVoid1<A> f) {
Object[] args = new Object[] {};
return buildVoidReturnCaller(f, args);
}
default <T0, R> ParallelActorTaskCaller<R> task(RayFunc2<A, T0, R> f, T0 t0) {
Object[] args = new Object[] {t0};
return buildCaller(f, args);
}
default <T0, R> ParallelActorTaskCaller<R> task(RayFunc2<A, T0, R> f, ObjectRef<T0> t0) {
Object[] args = new Object[] {t0};
return buildCaller(f, args);
}
default <T0> VoidParallelActorTaskCaller task(RayFuncVoid2<A, T0> f, T0 t0) {
Object[] args = new Object[] {t0};
return buildVoidReturnCaller(f, args);
}
default <T0> VoidParallelActorTaskCaller task(RayFuncVoid2<A, T0> f, ObjectRef<T0> t0) {
Object[] args = new Object[] {t0};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, R> ParallelActorTaskCaller<R> task(RayFunc3<A, T0, T1, R> f, T0 t0, T1 t1) {
Object[] args = new Object[] {t0, t1};
return buildCaller(f, args);
}
default <T0, T1, R> ParallelActorTaskCaller<R> task(RayFunc3<A, T0, T1, R> f, T0 t0, ObjectRef<T1> t1) {
Object[] args = new Object[] {t0, t1};
return buildCaller(f, args);
}
default <T0, T1, R> ParallelActorTaskCaller<R> task(RayFunc3<A, T0, T1, R> f, ObjectRef<T0> t0, T1 t1) {
Object[] args = new Object[] {t0, t1};
return buildCaller(f, args);
}
default <T0, T1, R> ParallelActorTaskCaller<R> task(RayFunc3<A, T0, T1, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1) {
Object[] args = new Object[] {t0, t1};
return buildCaller(f, args);
}
default <T0, T1> VoidParallelActorTaskCaller task(RayFuncVoid3<A, T0, T1> f, T0 t0, T1 t1) {
Object[] args = new Object[] {t0, t1};
return buildVoidReturnCaller(f, args);
}
default <T0, T1> VoidParallelActorTaskCaller task(RayFuncVoid3<A, T0, T1> f, T0 t0, ObjectRef<T1> t1) {
Object[] args = new Object[] {t0, t1};
return buildVoidReturnCaller(f, args);
}
default <T0, T1> VoidParallelActorTaskCaller task(RayFuncVoid3<A, T0, T1> f, ObjectRef<T0> t0, T1 t1) {
Object[] args = new Object[] {t0, t1};
return buildVoidReturnCaller(f, args);
}
default <T0, T1> VoidParallelActorTaskCaller task(RayFuncVoid3<A, T0, T1> f, ObjectRef<T0> t0, ObjectRef<T1> t1) {
Object[] args = new Object[] {t0, t1};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, R> ParallelActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, T0 t0, T1 t1, T2 t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildCaller(f, args);
}
default <T0, T1, T2, R> ParallelActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, T0 t0, T1 t1, ObjectRef<T2> t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildCaller(f, args);
}
default <T0, T1, T2, R> ParallelActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, T0 t0, ObjectRef<T1> t1, T2 t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildCaller(f, args);
}
default <T0, T1, T2, R> ParallelActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildCaller(f, args);
}
default <T0, T1, T2, R> ParallelActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, ObjectRef<T0> t0, T1 t1, T2 t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildCaller(f, args);
}
default <T0, T1, T2, R> ParallelActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildCaller(f, args);
}
default <T0, T1, T2, R> ParallelActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildCaller(f, args);
}
default <T0, T1, T2, R> ParallelActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildCaller(f, args);
}
default <T0, T1, T2> VoidParallelActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, T1 t1, T2 t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2> VoidParallelActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, T1 t1, ObjectRef<T2> t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2> VoidParallelActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, ObjectRef<T1> t1, T2 t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2> VoidParallelActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2> VoidParallelActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, ObjectRef<T0> t0, T1 t1, T2 t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2> VoidParallelActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2> VoidParallelActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2> VoidParallelActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
Object[] args = new Object[] {t0, t1, t2};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, T2 t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, R> ParallelActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, T2 t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3> VoidParallelActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4, R> ParallelActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
default <T0, T1, T2, T3, T4> VoidParallelActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return buildVoidReturnCaller(f, args);
}
}

View file

@ -0,0 +1,656 @@
// Generated by `ParallelActorCallGenerator.java`. DO NOT EDIT.
package io.ray.api.parallelactor;
import io.ray.api.ObjectRef;
import io.ray.api.function.RayFunc0;
import io.ray.api.function.RayFunc1;
import io.ray.api.function.RayFunc2;
import io.ray.api.function.RayFunc3;
import io.ray.api.function.RayFunc4;
import io.ray.api.function.RayFunc5;
import io.ray.api.function.RayFunc6;
/**
* This class provides type-safe interfaces for `ParallelActor.actor`.
**/
class Call {
// ===========================
// Methods for actor creation.
// ===========================
public static <A> ParallelActorCreator<A> actor(RayFunc0<A> f) {
Object[] args = new Object[] {};
return new ParallelActorCreator<>(f, args);
}
public static <T0, A> ParallelActorCreator<A> actor(RayFunc1<T0, A> f, T0 t0) {
Object[] args = new Object[] {t0};
return new ParallelActorCreator<>(f, args);
}
public static <T0, A> ParallelActorCreator<A> actor(RayFunc1<T0, A> f, ObjectRef<T0> t0) {
Object[] args = new Object[] {t0};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, A> ParallelActorCreator<A> actor(RayFunc2<T0, T1, A> f, T0 t0, T1 t1) {
Object[] args = new Object[] {t0, t1};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, A> ParallelActorCreator<A> actor(RayFunc2<T0, T1, A> f, T0 t0, ObjectRef<T1> t1) {
Object[] args = new Object[] {t0, t1};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, A> ParallelActorCreator<A> actor(RayFunc2<T0, T1, A> f, ObjectRef<T0> t0, T1 t1) {
Object[] args = new Object[] {t0, t1};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, A> ParallelActorCreator<A> actor(RayFunc2<T0, T1, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1) {
Object[] args = new Object[] {t0, t1};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, A> ParallelActorCreator<A> actor(RayFunc3<T0, T1, T2, A> f, T0 t0, T1 t1, T2 t2) {
Object[] args = new Object[] {t0, t1, t2};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, A> ParallelActorCreator<A> actor(RayFunc3<T0, T1, T2, A> f, T0 t0, T1 t1, ObjectRef<T2> t2) {
Object[] args = new Object[] {t0, t1, t2};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, A> ParallelActorCreator<A> actor(RayFunc3<T0, T1, T2, A> f, T0 t0, ObjectRef<T1> t1, T2 t2) {
Object[] args = new Object[] {t0, t1, t2};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, A> ParallelActorCreator<A> actor(RayFunc3<T0, T1, T2, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
Object[] args = new Object[] {t0, t1, t2};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, A> ParallelActorCreator<A> actor(RayFunc3<T0, T1, T2, A> f, ObjectRef<T0> t0, T1 t1, T2 t2) {
Object[] args = new Object[] {t0, t1, t2};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, A> ParallelActorCreator<A> actor(RayFunc3<T0, T1, T2, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2) {
Object[] args = new Object[] {t0, t1, t2};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, A> ParallelActorCreator<A> actor(RayFunc3<T0, T1, T2, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2) {
Object[] args = new Object[] {t0, t1, t2};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, A> ParallelActorCreator<A> actor(RayFunc3<T0, T1, T2, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
Object[] args = new Object[] {t0, t1, t2};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, T0 t0, T1 t1, T2 t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, A> ParallelActorCreator<A> actor(RayFunc4<T0, T1, T2, T3, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
Object[] args = new Object[] {t0, t1, t2, t3};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, A> ParallelActorCreator<A> actor(RayFunc5<T0, T1, T2, T3, T4, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
Object[] args = new Object[] {t0, t1, t2, t3, t4};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4, T5 t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
public static <T0, T1, T2, T3, T4, T5, A> ParallelActorCreator<A> actor(RayFunc6<T0, T1, T2, T3, T4, T5, A> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4, ObjectRef<T5> t5) {
Object[] args = new Object[] {t0, t1, t2, t3, t4, t5};
return new ParallelActorCreator<>(f, args);
}
}

View file

@ -0,0 +1,7 @@
package io.ray.api.parallelactor;
/**
* The `ParallelActor` is used for creating multiple execution instances in different threads, to
* execute the methods. The methods will be invoked on the instances in different threads.
*/
public class ParallelActor extends Call {}

View file

@ -0,0 +1,13 @@
package io.ray.api.parallelactor;
import io.ray.api.ObjectRef;
import io.ray.api.function.RayFunc;
import io.ray.api.function.RayFuncR;
public interface ParallelActorContext {
<A> ParallelActorHandle<A> createParallelActorExecutor(int parallelism, RayFuncR<A> ctorFunc);
<A, R> ObjectRef<R> submitTask(
ParallelActorHandle<A> parallelActorHandle, int instanceId, RayFunc func, Object[] args);
}

View file

@ -0,0 +1,28 @@
package io.ray.api.parallelactor;
import io.ray.api.Ray;
import io.ray.api.function.RayFuncR;
public class ParallelActorCreator<A> {
private int parallelism = 1;
private RayFuncR<A> func;
private Object[] args;
public ParallelActorCreator(RayFuncR<A> func, Object[] args) {
this.func = func;
this.args = args;
}
public ParallelActorCreator<A> setParallelism(int parallelism) {
this.parallelism = parallelism;
return this;
}
public ParallelActorHandle<A> remote() {
ParallelActorContext ctx = Ray.internal().getParallelActorContext();
return ctx.createParallelActorExecutor(parallelism, this.func);
}
}

View file

@ -0,0 +1,16 @@
package io.ray.api.parallelactor;
import io.ray.api.ActorHandle;
/** The handle to a parallel actor. */
public interface ParallelActorHandle<A> {
/** Get an execution instance of the parallel actor by the given instance ID. */
ParallelActorInstance<A> getInstance(int instanceId);
/** Get the parallelism of this parallel actor. */
int getParallelism();
/** Get the real actor handle to use. */
ActorHandle<?> getHandle();
}

View file

@ -0,0 +1,21 @@
package io.ray.api.parallelactor;
public class ParallelActorInstance<A> implements ActorCall<A> {
private ParallelActorHandle<A> parallelActorHandle;
private int instanceId;
public ParallelActorInstance(ParallelActorHandle<A> parallelActorHandle, int instanceId) {
this.parallelActorHandle = parallelActorHandle;
this.instanceId = instanceId;
}
ParallelActorHandle<A> getActor() {
return parallelActorHandle;
}
int getInstanceId() {
return instanceId;
}
}

View file

@ -0,0 +1,25 @@
package io.ray.api.parallelactor;
import io.ray.api.ObjectRef;
import io.ray.api.Ray;
import io.ray.api.function.RayFuncR;
public class ParallelActorTaskCaller<R> {
private ParallelActorInstance instance;
private RayFuncR<R> func;
private Object[] args;
public ParallelActorTaskCaller(ParallelActorInstance instance, RayFuncR<R> func, Object[] args) {
this.instance = instance;
this.func = func;
this.args = args;
}
public ObjectRef<R> remote() {
ParallelActorContext ctx = Ray.internal().getParallelActorContext();
return ctx.submitTask(instance.getActor(), instance.getInstanceId(), func, args);
}
}

View file

@ -0,0 +1,25 @@
package io.ray.api.parallelactor;
import io.ray.api.Ray;
import io.ray.api.function.RayFuncVoid;
public class VoidParallelActorTaskCaller {
private ParallelActorInstance instance;
private RayFuncVoid func;
private Object[] args;
public VoidParallelActorTaskCaller(
ParallelActorInstance instance, RayFuncVoid func, Object[] args) {
this.instance = instance;
this.func = func;
this.args = args;
}
public void remote() {
ParallelActorContext ctx = Ray.internal().getParallelActorContext();
ctx.submitTask(instance.getActor(), instance.getInstanceId(), func, args);
}
}

View file

@ -16,6 +16,7 @@ import io.ray.api.id.PlacementGroupId;
import io.ray.api.options.ActorCreationOptions; import io.ray.api.options.ActorCreationOptions;
import io.ray.api.options.CallOptions; import io.ray.api.options.CallOptions;
import io.ray.api.options.PlacementGroupCreationOptions; import io.ray.api.options.PlacementGroupCreationOptions;
import io.ray.api.parallelactor.ParallelActorContext;
import io.ray.api.placementgroup.PlacementGroup; import io.ray.api.placementgroup.PlacementGroup;
import io.ray.api.runtimecontext.ResourceValue; import io.ray.api.runtimecontext.ResourceValue;
import io.ray.api.runtimecontext.RuntimeContext; import io.ray.api.runtimecontext.RuntimeContext;
@ -286,4 +287,7 @@ public interface RayRuntime {
/** Create runtime env instance at runtime. */ /** Create runtime env instance at runtime. */
RuntimeEnv createRuntimeEnv(Map<String, String> envVars); RuntimeEnv createRuntimeEnv(Map<String, String> envVars);
/// Get the parallel actor context at runtime.
ParallelActorContext getParallelActorContext();
} }

View file

@ -29,7 +29,7 @@
<!-- exclude the generated files from being parsed, which make checkstyle check more fast --> <!-- exclude the generated files from being parsed, which make checkstyle check more fast -->
<module name="BeforeExecutionExclusionFileFilter"> <module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" <property name="fileNamePattern"
value="io[\\/]ray[\\/].*runtime[\\/]generated[\\/]|RayCall.java|ActorCall.java|io[\\/]ray[\\/].*serve[\\/]generated[\\/]"/> value="io[\\/]ray[\\/].*runtime[\\/]generated[\\/]|RayCall.java|ActorCall.java|io[\\/]ray[\\/].*serve[\\/]generated[\\/]|Call.java|ActorCall.java|"/>
</module> </module>
<module name="TreeWalker"> <module name="TreeWalker">

View file

@ -252,6 +252,8 @@
<excludes> <excludes>
<exclude>**/RayCall.java</exclude> <exclude>**/RayCall.java</exclude>
<exclude>**/ActorCall.java</exclude> <exclude>**/ActorCall.java</exclude>
<exclude>**/Call.java</exclude>
<exclude>**/ActorCall.java</exclude>
<exclude>**/PyActorCall.java</exclude> <exclude>**/PyActorCall.java</exclude>
<exclude>**/runtime/generated/**/*.*</exclude> <exclude>**/runtime/generated/**/*.*</exclude>
<exclude>**/serve/generated/**/*.*</exclude> <exclude>**/serve/generated/**/*.*</exclude>

View file

@ -19,6 +19,7 @@ import io.ray.api.id.PlacementGroupId;
import io.ray.api.options.ActorCreationOptions; import io.ray.api.options.ActorCreationOptions;
import io.ray.api.options.CallOptions; import io.ray.api.options.CallOptions;
import io.ray.api.options.PlacementGroupCreationOptions; import io.ray.api.options.PlacementGroupCreationOptions;
import io.ray.api.parallelactor.ParallelActorContext;
import io.ray.api.placementgroup.PlacementGroup; import io.ray.api.placementgroup.PlacementGroup;
import io.ray.api.runtimecontext.RuntimeContext; import io.ray.api.runtimecontext.RuntimeContext;
import io.ray.api.runtimeenv.RuntimeEnv; import io.ray.api.runtimeenv.RuntimeEnv;
@ -40,6 +41,7 @@ import io.ray.runtime.task.FunctionArg;
import io.ray.runtime.task.TaskExecutor; import io.ray.runtime.task.TaskExecutor;
import io.ray.runtime.task.TaskSubmitter; import io.ray.runtime.task.TaskSubmitter;
import io.ray.runtime.util.ConcurrencyGroupUtils; import io.ray.runtime.util.ConcurrencyGroupUtils;
import io.ray.runtime.utils.parallelactor.ParallelActorContextImpl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -63,6 +65,8 @@ public abstract class AbstractRayRuntime implements RayRuntimeInternal {
protected TaskSubmitter taskSubmitter; protected TaskSubmitter taskSubmitter;
protected WorkerContext workerContext; protected WorkerContext workerContext;
private static ParallelActorContextImpl parallelActorContextImpl = new ParallelActorContextImpl();
/** Whether the required thread context is set on the current thread. */ /** Whether the required thread context is set on the current thread. */
final ThreadLocal<Boolean> isContextSet = ThreadLocal.withInitial(() -> false); final ThreadLocal<Boolean> isContextSet = ThreadLocal.withInitial(() -> false);
@ -288,6 +292,11 @@ public abstract class AbstractRayRuntime implements RayRuntimeInternal {
return ConcurrencyGroupUtils.extractConcurrencyGroupsByAnnotations(actorConstructorLambda); return ConcurrencyGroupUtils.extractConcurrencyGroupsByAnnotations(actorConstructorLambda);
} }
@Override
public ParallelActorContext getParallelActorContext() {
return parallelActorContextImpl;
}
@Override @Override
public RuntimeEnv createRuntimeEnv(Map<String, String> envVars) { public RuntimeEnv createRuntimeEnv(Map<String, String> envVars) {
return new RuntimeEnvImpl(envVars); return new RuntimeEnvImpl(envVars);

View file

@ -3,10 +3,13 @@ package io.ray.runtime.functionmanager;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import io.ray.runtime.generated.Common.Language; import io.ray.runtime.generated.Common.Language;
import java.io.Serializable;
import java.util.List; import java.util.List;
/** Represents metadata of Java function. */ /** Represents metadata of Java function. */
public final class JavaFunctionDescriptor implements FunctionDescriptor { public final class JavaFunctionDescriptor implements FunctionDescriptor, Serializable {
private static final long serialVersionUID = -2137471820857197094L;
/** Function's class name. */ /** Function's class name. */
public final String className; public final String className;

View file

@ -0,0 +1,315 @@
package io.ray.runtime.util.generator;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.FileUtils;
/**
* A util class that generates `RayCall.java` and `ActorCall.java`, which provide type-safe
* interfaces for `Ray.call`, `Ray.createActor` and `actor.call`.
*/
public class ParallelActorCallGenerator extends BaseGenerator {
/** Returns Whole file content of `RayCall.java`. */
private String generateRayCallDotJava() {
sb = new StringBuilder();
newLine("// Generated by `ParallelActorCallGenerator.java`. DO NOT EDIT.");
newLine("");
newLine("package io.ray.api.parallelactor;");
newLine("");
newLine("import io.ray.api.ObjectRef;");
for (int i = 0; i <= MAX_PARAMETERS; i++) {
newLine("import io.ray.api.function.RayFunc" + i + ";");
}
newLine("");
newLine("/**");
newLine(" * This class provides type-safe interfaces for `ParallelActor.actor`.");
newLine(" **/");
newLine("class Call {");
newLine(1, "// ===========================");
newLine(1, "// Methods for actor creation.");
newLine(1, "// ===========================");
for (int i = 0; i <= MAX_PARAMETERS; i++) {
buildCalls(i, false, true, true);
}
newLine("}");
return sb.toString();
}
/** Returns Whole file content of `ActorCall.java`. */
private String generateActorCallDotJava() {
sb = new StringBuilder();
newLine("// Generated by `RayCallGenerator.java`. DO NOT EDIT.");
newLine("");
newLine("package io.ray.api.parallelactor;");
newLine("");
newLine("import io.ray.api.ObjectRef;");
newLine("import io.ray.api.function.RayFuncVoid;");
newLine("import io.ray.api.function.RayFuncR;");
for (int i = 1; i <= MAX_PARAMETERS; i++) {
newLine("import io.ray.api.function.RayFunc" + i + ";");
}
for (int i = 1; i <= MAX_PARAMETERS; i++) {
newLine("import io.ray.api.function.RayFuncVoid" + i + ";");
}
newLine("");
newLine("/**");
newLine(" * This class provides type-safe interfaces for remote actor calls.");
newLine(" **/");
newLine("interface ActorCall<A> {");
newLine("");
{
/// Generate buildVoidReturnCaller()
newLine(
0,
" default VoidParallelActorTaskCaller buildVoidReturnCaller(RayFuncVoid func, Object[] args) {\n"
+ " return new VoidParallelActorTaskCaller((ParallelActorInstance) this, func, args);\n"
+ " }\n");
/// Generate buildCaller()
newLine(
0,
" default <R> ParallelActorTaskCaller<R> buildCaller(RayFuncR<R> func, Object[] args) {\n"
+ " return new ParallelActorTaskCaller<R>((ParallelActorInstance) this, func, args);\n"
+ " }\n");
}
for (int i = 0; i <= MAX_PARAMETERS - 1; i++) {
buildCalls(i, true, false, true);
buildCalls(i, true, false, false);
}
newLine("}");
return sb.toString();
}
/**
* Build `Ray.call`, `Ray.createActor` and `actor.call` methods with the given number of
* parameters.
*
* @param numParameters the number of parameters
* @param forActor Build `actor.call` when true, otherwise build `Ray.call`.
* @param hasReturn if true, Build api for functions with return.
* @param forActorCreation Build `Ray.createActor` when true, otherwise build `Ray.call`.
*/
private void buildCalls(
int numParameters, boolean forActor, boolean forActorCreation, boolean hasReturn) {
String modifiers = forActor ? "default" : "public static";
// 1) Construct the `genericTypes` part, e.g. `<T0, T1, T2, R>`.
String genericTypes = "";
for (int i = 0; i < numParameters; i++) {
genericTypes += "T" + i + ", ";
}
// Return generic type.
if (forActorCreation) {
genericTypes += "A, ";
} else {
if (hasReturn) {
genericTypes += "R, ";
}
}
if (!genericTypes.isEmpty()) {
// Trim trailing ", ";
genericTypes = genericTypes.substring(0, genericTypes.length() - 2);
genericTypes = "<" + genericTypes + ">";
}
// 2) Construct the `returnType` part.
String returnType;
if (forActorCreation) {
returnType = "ParallelActorCreator<A>";
} else {
if (forActor) {
returnType = hasReturn ? "ParallelActorTaskCaller<R>" : "VoidParallelActorTaskCaller";
} else {
// TODO(qwang): This should be removed since we don't have normal task calls for parallel
// actor.
returnType = hasReturn ? "TaskCaller<R>" : "VoidTaskCaller";
}
}
// 3) Construct the `argsDeclaration` part.
String rayFuncGenericTypes = genericTypes;
if (forActor) {
if (rayFuncGenericTypes.isEmpty()) {
rayFuncGenericTypes = "<A>";
} else {
rayFuncGenericTypes = rayFuncGenericTypes.replace("<", "<A, ");
}
}
String argsDeclarationPrefix =
String.format(
"RayFunc%s%d%s f, ",
hasReturn ? "" : "Void",
!forActor ? numParameters : numParameters + 1,
rayFuncGenericTypes);
String callFunc = forActorCreation ? "actor" : "task";
String caller;
if (forActorCreation) {
caller = "ParallelActorCreator<>";
} else {
if (forActor) {
caller = hasReturn ? "buildCaller" : "buildVoidReturnCaller";
} else {
caller = hasReturn ? "buildCaller" : "buildVoidReturnCaller";
}
}
// Enumerate all combinations of the parameters.
for (String param : generateParameters(numParameters)) {
String argsDeclaration = argsDeclarationPrefix + param;
// Trim trailing ", ";
argsDeclaration = argsDeclaration.substring(0, argsDeclaration.length() - 2);
// Print the first line (method signature).
newLine(
1,
String.format(
"%s%s %s %s(%s) {",
modifiers,
genericTypes.isEmpty() ? "" : " " + genericTypes,
returnType,
callFunc,
argsDeclaration));
// 4) Construct the `args` part.
String args = "";
for (int i = 0; i < numParameters; i++) {
args += "t" + i + ", ";
}
// Trim trailing ", ";
if (!args.isEmpty()) {
args = args.substring(0, args.length() - 2);
}
// Print the second line (local args declaration).
newLine(2, String.format("Object[] args = new Object[] {%s};", args));
// 5) Construct the third line.
String ctrArgs = "";
// if (forActor) {
// ctrArgs += "(ParallelActor) this, ";
// }
ctrArgs += "f, args, ";
ctrArgs = ctrArgs.substring(0, ctrArgs.length() - 2);
if (forActorCreation) {
newLine(2, String.format("return new %s(%s);", caller, ctrArgs));
} else {
newLine(2, String.format("return %s(%s);", caller, ctrArgs));
}
newLine(1, "}");
newLine("");
}
}
/**
* Build `Ray.call`, `Ray.createActor` and `actor.call` methods with the given number of
* parameters.
*
* @param numParameters the number of parameters
* @param forActor Build `actor.call` when true, otherwise build `Ray.call`.
* @param forActorCreation Build `Ray.createActor` when true, otherwise build `Ray.call`.
*/
private void buildPyCalls(int numParameters, boolean forActor, boolean forActorCreation) {
String modifiers = forActor ? "default" : "public static";
String argList = "";
String paramList = "";
for (int i = 0; i < numParameters; i++) {
paramList += "Object obj" + i + ", ";
argList += "obj" + i + ", ";
}
if (argList.endsWith(", ")) {
argList = argList.substring(0, argList.length() - 2);
}
if (paramList.endsWith(", ")) {
paramList = paramList.substring(0, paramList.length() - 2);
}
String paramPrefix = "";
String funcArgs = "";
if (forActorCreation) {
paramPrefix += "PyActorClass pyActorClass";
funcArgs += "pyActorClass";
} else if (forActor) {
paramPrefix += "PyActorMethod<R> pyActorMethod";
funcArgs += "pyActorMethod";
} else {
paramPrefix += "PyFunction<R> pyFunction";
funcArgs += "pyFunction";
}
if (numParameters > 0) {
paramPrefix += ", ";
}
String genericType = forActorCreation ? "" : " <R>";
String returnType =
forActorCreation
? "ParallelActorCreator"
: forActor ? "PyActorTaskCaller<R>" : "PyTaskCaller<R>";
String funcName = forActorCreation ? "actor" : "task";
String caller =
forActorCreation
? "ParallelActorCreator"
: forActor ? "PyActorTaskCaller<>" : "PyTaskCaller<>";
funcArgs += ", args";
// Method signature.
newLine(
1,
String.format(
"%s%s %s %s(%s) {",
modifiers, genericType, returnType, funcName, paramPrefix + paramList));
// Method body.
newLine(2, String.format("Object[] args = new Object[] {%s};", argList));
if (forActor) {
newLine(2, String.format("return new %s((PyActorHandle)this, %s);", caller, funcArgs));
} else {
newLine(2, String.format("return new %s(%s);", caller, funcArgs));
}
newLine(1, "}");
newLine("");
}
private List<String> generateParameters(int numParams) {
List<String> res = new ArrayList<>();
dfs(0, numParams, "", res);
return res;
}
private void dfs(int pos, int numParams, String cur, List<String> res) {
if (pos >= numParams) {
res.add(cur);
return;
}
String nextParameter = String.format("T%d t%d, ", pos, pos);
dfs(pos + 1, numParams, cur + nextParameter, res);
nextParameter = String.format("ObjectRef<T%d> t%d, ", pos, pos);
dfs(pos + 1, numParams, cur + nextParameter, res);
}
public static void main(String[] args) throws IOException {
String path =
System.getProperty("user.dir") + "/api/src/main/java/io/ray/api/parallelactor/Call.java";
FileUtils.write(
new File(path),
new ParallelActorCallGenerator().generateRayCallDotJava(),
Charset.defaultCharset());
path =
System.getProperty("user.dir")
+ "/api/src/main/java/io/ray/api/parallelactor/ActorCall.java";
FileUtils.write(
new File(path),
new ParallelActorCallGenerator().generateActorCallDotJava(),
Charset.defaultCharset());
}
}

View file

@ -0,0 +1,59 @@
package io.ray.runtime.utils.parallelactor;
import io.ray.api.ActorHandle;
import io.ray.api.ObjectRef;
import io.ray.api.Ray;
import io.ray.api.concurrencygroup.ConcurrencyGroup;
import io.ray.api.concurrencygroup.ConcurrencyGroupBuilder;
import io.ray.api.function.RayFunc;
import io.ray.api.function.RayFuncR;
import io.ray.api.parallelactor.*;
import io.ray.runtime.RayRuntimeInternal;
import io.ray.runtime.functionmanager.FunctionManager;
import io.ray.runtime.functionmanager.JavaFunctionDescriptor;
public class ParallelActorContextImpl implements ParallelActorContext {
@Override
public <A> ParallelActorHandle<A> createParallelActorExecutor(
int parallelism, RayFuncR<A> ctorFunc) {
ConcurrencyGroup[] concurrencyGroups = new ConcurrencyGroup[parallelism];
for (int i = 0; i < parallelism; ++i) {
concurrencyGroups[i] =
new ConcurrencyGroupBuilder<ParallelActorExecutorImpl>()
.setName(String.format("PARALLEL_INSTANCE_%d", i))
.setMaxConcurrency(1)
.build();
}
FunctionManager functionManager = ((RayRuntimeInternal) Ray.internal()).getFunctionManager();
JavaFunctionDescriptor functionDescriptor =
functionManager
.getFunction(Ray.getRuntimeContext().getCurrentJobId(), ctorFunc)
.getFunctionDescriptor();
ActorHandle<ParallelActorExecutorImpl> parallelExecutorHandle =
Ray.actor(ParallelActorExecutorImpl::new, parallelism, functionDescriptor)
.setConcurrencyGroups(concurrencyGroups)
.remote();
return new ParallelActorHandleImpl<>(parallelism, parallelExecutorHandle);
}
@Override
public <A, R> ObjectRef<R> submitTask(
ParallelActorHandle<A> parallelActorHandle, int instanceId, RayFunc func, Object[] args) {
ActorHandle<ParallelActorExecutorImpl> parallelExecutor =
((ParallelActorHandleImpl) parallelActorHandle).getExecutor();
FunctionManager functionManager = ((RayRuntimeInternal) Ray.internal()).getFunctionManager();
JavaFunctionDescriptor functionDescriptor =
functionManager
.getFunction(Ray.getRuntimeContext().getCurrentJobId(), func)
.getFunctionDescriptor();
ObjectRef<Object> ret =
parallelExecutor
.task(ParallelActorExecutorImpl::execute, instanceId, functionDescriptor, args)
.setConcurrencyGroup(String.format("PARALLEL_INSTANCE_%d", instanceId))
.remote();
return (ObjectRef<R>) ret;
}
}

View file

@ -0,0 +1,43 @@
package io.ray.runtime.utils.parallelactor;
import com.google.common.base.Preconditions;
import io.ray.api.Ray;
import io.ray.runtime.RayRuntimeInternal;
import io.ray.runtime.functionmanager.FunctionManager;
import io.ray.runtime.functionmanager.JavaFunctionDescriptor;
import io.ray.runtime.functionmanager.RayFunction;
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.ConcurrentHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ParallelActorExecutorImpl {
private static final Logger LOG = LoggerFactory.getLogger(ParallelActorExecutorImpl.class);
private FunctionManager functionManager = null;
private ConcurrentHashMap<Integer, Object> instances = new ConcurrentHashMap<>();
public ParallelActorExecutorImpl(int parallelism, JavaFunctionDescriptor javaFunctionDescriptor)
throws InvocationTargetException, IllegalAccessException {
functionManager = ((RayRuntimeInternal) Ray.internal()).getFunctionManager();
RayFunction init =
functionManager.getFunction(
Ray.getRuntimeContext().getCurrentJobId(), javaFunctionDescriptor);
Thread.currentThread().setContextClassLoader(init.classLoader);
for (int i = 0; i < parallelism; ++i) {
Object instance = init.getMethod().invoke(null, null);
instances.put(i, instance);
}
}
public Object execute(int instanceId, JavaFunctionDescriptor functionDescriptor, Object[] args)
throws IllegalAccessException, InvocationTargetException {
RayFunction func =
functionManager.getFunction(Ray.getRuntimeContext().getCurrentJobId(), functionDescriptor);
Preconditions.checkState(instances.containsKey(instanceId));
return func.getMethod().invoke(instances.get(instanceId), args);
}
}

View file

@ -0,0 +1,40 @@
package io.ray.runtime.utils.parallelactor;
import io.ray.api.ActorHandle;
import io.ray.api.parallelactor.ParallelActorHandle;
import io.ray.api.parallelactor.ParallelActorInstance;
import java.io.Serializable;
public class ParallelActorHandleImpl<A> implements ParallelActorHandle<A>, Serializable {
private int parallelism = 1;
private ActorHandle<ParallelActorExecutorImpl> parallelExecutorHandle = null;
// An empty ctor for FST serializing need.
public ParallelActorHandleImpl() {}
public ParallelActorHandleImpl(int parallelism, ActorHandle<ParallelActorExecutorImpl> handle) {
this.parallelism = parallelism;
parallelExecutorHandle = handle;
}
@Override
public ParallelActorInstance<A> getInstance(int instanceId) {
return new ParallelActorInstance<A>(this, instanceId);
}
public ActorHandle<? extends ParallelActorExecutorImpl> getExecutor() {
return parallelExecutorHandle;
}
@Override
public int getParallelism() {
return parallelism;
}
@Override
public ActorHandle<?> getHandle() {
return parallelExecutorHandle;
}
}

View file

@ -0,0 +1,128 @@
package io.ray.test;
import com.google.common.base.Preconditions;
import io.ray.api.ActorHandle;
import io.ray.api.ObjectRef;
import io.ray.api.Ray;
import io.ray.api.parallelactor.*;
import io.ray.runtime.exception.RayActorException;
import io.ray.runtime.util.SystemUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.Test;
@Test(groups = "cluster")
public class ParallelActorTest extends BaseTest {
private static final Logger LOG = LoggerFactory.getLogger(ParallelActorTest.class);
private static class A {
private int value = 0;
public int incr(int delta) {
value += delta;
return value;
}
public int getValue() {
return value;
}
public int add(int a, int b) {
return a + b;
}
public int getPid() {
// TODO(qwang): We should fix this once Serialization2.0 finished.
return 1000000 + SystemUtil.pid();
}
public int getThreadId() {
return 1000000 + (int) Thread.currentThread().getId();
}
}
public void testBasic() {
ParallelActorHandle<A> actor = ParallelActor.actor(A::new).setParallelism(10).remote();
{
// stateless tests
ParallelActorInstance<A> instance = actor.getInstance(2);
Preconditions.checkNotNull(instance);
int res = instance.task(A::add, 100000, 200000).remote().get(); // Executed in instance 2
Assert.assertEquals(res, 300000);
instance = actor.getInstance(3);
Preconditions.checkNotNull(instance);
res = instance.task(A::add, 100000, 200000).remote().get(); // Executed in instance 2
Assert.assertEquals(res, 300000);
}
{
// stateful tests
ParallelActorInstance<A> instance = actor.getInstance(2);
Preconditions.checkNotNull(instance);
int res = instance.task(A::incr, 1000000).remote().get(); // Executed in instance 2
Assert.assertEquals(res, 1000000);
instance = actor.getInstance(2);
Preconditions.checkNotNull(instance);
res = instance.task(A::incr, 2000000).remote().get(); // Executed in instance 2
Assert.assertEquals(res, 3000000);
}
{
// Test they are in the same process.
ParallelActorInstance<A> instance = actor.getInstance(0);
Preconditions.checkNotNull(instance);
int pid1 = instance.task(A::getPid).remote().get();
instance = actor.getInstance(1);
Preconditions.checkNotNull(instance);
int pid2 = instance.task(A::getPid).remote().get();
Assert.assertEquals(pid1, pid2);
}
{
// Test they are in different threads.
ParallelActorInstance<A> instance = actor.getInstance(4);
Preconditions.checkNotNull(instance);
int thread1 = instance.task(A::getThreadId).remote().get();
instance = actor.getInstance(5);
Preconditions.checkNotNull(instance);
int thread2 = instance.task(A::getThreadId).remote().get();
Assert.assertNotEquals(thread1, thread2);
}
}
private static boolean passParallelActor(ParallelActorHandle<A> parallelActorHandle) {
ObjectRef<Integer> obj0 = parallelActorHandle.getInstance(0).task(A::incr, 1000000).remote();
ObjectRef<Integer> obj1 = parallelActorHandle.getInstance(1).task(A::incr, 2000000).remote();
Assert.assertEquals(2000000, (int) obj0.get());
Assert.assertEquals(4000000, (int) obj1.get());
return true;
}
public void testPassParallelActorHandle() {
ParallelActorHandle<A> actor = ParallelActor.actor(A::new).setParallelism(10).remote();
ObjectRef<Integer> obj0 = actor.getInstance(0).task(A::incr, 1000000).remote();
ObjectRef<Integer> obj1 = actor.getInstance(1).task(A::incr, 2000000).remote();
Assert.assertEquals(1000000, (int) obj0.get());
Assert.assertEquals(2000000, (int) obj1.get());
Assert.assertTrue(Ray.task(ParallelActorTest::passParallelActor, actor).remote().get());
}
public void testKillParallelActor() {
ParallelActorHandle<A> actor = ParallelActor.actor(A::new).setParallelism(10).remote();
ObjectRef<Integer> obj0 = actor.getInstance(0).task(A::incr, 1000000).remote();
Assert.assertEquals(1000000, (int) obj0.get());
ActorHandle<?> handle = actor.getHandle();
handle.kill(true);
final ObjectRef<Integer> obj1 = actor.getInstance(0).task(A::incr, 1000000).remote();
Assert.expectThrows(RayActorException.class, obj1::get);
}
}