io.ray.api.ActorHandle Maven / Gradle / Ivy
package io.ray.api;
/**
* A handle to a Java actor.
*
* A handle can be used to invoke a remote actor method, with the {@code "call"} method. For
* example:
*
*
{@code
* class MyActor {
* public int echo(int x) {
* return x;
* }
* }
* // Create an actor, and get a handle.
* ActorHandle myActor = Ray.actor(MyActor::new).remote();
* // Call the `echo` method remotely.
* ObjectRef result = myActor.task(MyActor::echo, 1).remote();
* // Get the result of the remote `echo` method.
* Assert.assertEqual(result.get(), 1);
* }
*
* Note, the {@code "call"} method is defined in {@link ActorCall} interface, with multiple
* overloaded versions.
*
* @param The type of the concrete actor class.
*/
public interface ActorHandle extends BaseActorHandle, ActorCall {}