Implementation:Ray project Ray ActorTaskCaller
| Knowledge Sources | |
|---|---|
| Domains | Distributed_Computing, Java_API |
| Last Updated | 2026-02-13 16:00 GMT |
Overview
Fluent builder for invoking a Java actor method that returns a value provided by the Ray Java API.
Description
ActorTaskCaller<R> holds an ActorHandle, a RayFuncR<R> function reference, an arguments array, and a CallOptions.Builder. It provides setConcurrencyGroup(name) to specify which concurrency group the method should execute in. The remote() method calls Ray.internal().callActor(actor, func, args, builder.build()) and returns an ObjectRef<R> representing the future result.
Usage
Use this class as the terminal step before remote() dispatches an actor method call to the Ray runtime. It is the builder returned by actorHandle.task(MyActor::method, args) for Java actor methods with return values, and supports concurrency group selection for actors with multiple execution threads.
Code Reference
Source Location
- Repository: Ray
- File:
java/api/src/main/java/io/ray/api/call/ActorTaskCaller.java
Signature
public class ActorTaskCaller<R> {
public ActorTaskCaller(ActorHandle actor, RayFuncR<R> func, Object[] args);
public ActorTaskCaller<R> setConcurrencyGroup(String name);
public ObjectRef<R> remote();
}
Import
import io.ray.api.call.ActorTaskCaller;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| actor | ActorHandle |
Yes | Handle to the target actor |
| func | RayFuncR<R> |
Yes | Method reference to invoke on the actor |
| args | Object[] |
Yes | Arguments to pass to the actor method |
| name | String |
No | Concurrency group name (via setConcurrencyGroup)
|
Outputs
| Name | Type | Description |
|---|---|---|
| result | ObjectRef<R> |
Reference to the future result in the object store |
Usage Examples
// Call an actor method and get the result
ActorHandle<MyActor> actor = Ray.actor(MyActor::new).remote();
ObjectRef<String> result = actor.task(MyActor::greet, "world")
.setConcurrencyGroup("io-group")
.remote();
String greeting = result.get();