Package io.ray.api

Interface ActorHandle<A>

Type Parameters:
A - The type of the concrete actor class.
All Superinterfaces:
BaseActorHandle

public interface ActorHandle<A> extends BaseActorHandle
A handle to a Java actor.

A handle can be used to invoke a remote actor method, with the "call" method. For example:


 class MyActor {
   public int echo(int x) {
     return x;
   }
 }
 // Create an actor, and get a handle.
 ActorHandle<MyActor> myActor = Ray.actor(MyActor::new).remote();
 // Call the `echo` method remotely.
 ObjectRef<Integer> result = myActor.task(MyActor::echo, 1).remote();
 // Get the result of the remote `echo` method.
 Assert.assertEqual(result.get(), 1);
 

Note, the "call" method is defined in ActorCall interface, with multiple overloaded versions.