Implementation:Ray project Ray ParallelActor ActorCall
| Knowledge Sources | |
|---|---|
| Domains | Distributed_Computing, Java_API |
| Last Updated | 2026-02-13 16:00 GMT |
Overview
Type-safe interface for invoking remote method calls on parallel actor instances provided by the Ray Java API.
Description
ActorCall is a generic interface (ActorCall<A>) that provides numerous overloaded task() default methods for calling methods on parallel actors. Each overload accepts a typed RayFunc or RayFuncVoid lambda along with its arguments (which may be direct values or ObjectRef references), and delegates to buildCaller() or buildVoidReturnCaller() to construct ParallelActorTaskCaller<R> or VoidParallelActorTaskCaller instances. This file is auto-generated by RayCallGenerator.java and covers all permutations of argument counts and ObjectRef combinations up to 5 parameters.
Usage
Use this interface when you need compile-time type-safe invocations of methods on ParallelActorInstance objects. It is the primary mechanism through which parallel actor instances expose their task() methods for remote execution.
Code Reference
Source Location
- Repository: Ray
- File:
java/api/src/main/java/io/ray/api/parallelactor/ActorCall.java
Signature
interface ActorCall<A> {
default VoidParallelActorTaskCaller buildVoidReturnCaller(RayFuncVoid func, Object[] args);
default <R> ParallelActorTaskCaller<R> buildCaller(RayFuncR<R> func, Object[] args);
default <R> ParallelActorTaskCaller<R> task(RayFunc1<A, R> f);
default VoidParallelActorTaskCaller task(RayFuncVoid1<A> f);
// ... overloaded task() methods for up to 5 parameters with ObjectRef combinations
}
Import
import io.ray.api.parallelactor.ActorCall;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| f | RayFunc1<A, R> ... RayFunc6<A, T0..T4, R> |
Yes | A typed function reference (method reference) on actor class A |
| t0..t4 | T0...T4 or ObjectRef<T> |
Varies | Arguments to the remote method, either direct values or object references |
Outputs
| Name | Type | Description |
|---|---|---|
| caller | ParallelActorTaskCaller<R> |
A task caller for methods that return a value |
| voidCaller | VoidParallelActorTaskCaller |
A task caller for void methods |
Usage Examples
// Given a ParallelActorInstance that implements ActorCall<MyActor>
ParallelActorInstance<MyActor> actor = ...;
// Call a method with no arguments that returns a value
ParallelActorTaskCaller<String> caller = actor.task(MyActor::getName);
ObjectRef<String> result = caller.remote();
// Call a method with one argument
ParallelActorTaskCaller<Integer> caller2 = actor.task(MyActor::compute, 42);
ObjectRef<Integer> result2 = caller2.remote();
// Call a void method
VoidParallelActorTaskCaller voidCaller = actor.task(MyActor::reset);
voidCaller.remote();