mirror of
https://github.com/wassname/ray.git
synced 2026-07-01 19:49:45 +08:00
[java] support creating an actor with parameters (#2817)
Previously `Ray.createActor` only support creating an actor without any parameter. This PR adds the support for creating an actor with parameters. Moreover, besides using a constructor, it's now also allowed to create an actor with a factory method. For more usage, prefer refer to `ActorTest.java`.
This commit is contained in:
committed by
Robert Nishihara
parent
b37a283053
commit
9d655721e5
@@ -105,16 +105,6 @@ public final class Ray extends RayCall {
|
||||
return runtime.wait(waitList, waitList.size(), Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an actor on a remote node.
|
||||
*
|
||||
* @param actorClass the class of the actor to be created.
|
||||
* @return A handle to the newly created actor.
|
||||
*/
|
||||
public static <T> RayActor<T> createActor(Class<T> actorClass) {
|
||||
return runtime.createActor(actorClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying runtime instance.
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -52,14 +52,6 @@ public interface RayRuntime {
|
||||
*/
|
||||
<T> WaitResult<T> wait(List<RayObject<T>> waitList, int numReturns, int timeoutMs);
|
||||
|
||||
/**
|
||||
* Create an actor on a remote node.
|
||||
*
|
||||
* @param actorClass the class of the actor to be created.
|
||||
* @return A handle to the newly created actor.
|
||||
*/
|
||||
<T> RayActor<T> createActor(Class<T> actorClass);
|
||||
|
||||
/**
|
||||
* Invoke a remote function.
|
||||
*
|
||||
@@ -78,4 +70,14 @@ public interface RayRuntime {
|
||||
* @return The result object.
|
||||
*/
|
||||
RayObject call(RayFunc func, RayActor actor, Object[] args);
|
||||
|
||||
/**
|
||||
* Create an actor on a remote node.
|
||||
*
|
||||
* @param actorFactoryFunc A remote function whose return value is the actor object.
|
||||
* @param args The arguments for the remote function.
|
||||
* @param <T> The type of the actor object.
|
||||
* @return A handle to the actor.
|
||||
*/
|
||||
<T> RayActor<T> createActor(RayFunc actorFactoryFunc, Object[] args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user