Starting Java Actor

I’ve used Python ray for a while now, and am venturing into java.
The question is, how do you start a java class as an Actor if the class requires initializers (i.e., a constructor).
For example, take the stupid simple class:
public class Node() {
private int a;
private int b:

public Node (int start_a, int start_b) {
this.a = start_a;
this.b = start_b;

public SomeOtherMethode ( … ) {

It’s not clear at all to me how to instantiate this as an actor. If it were just instantiated as a non-actor instance, I could write something like:
Node myNode = new Node (1,2);

but suppose I want to make it an actor?
In python I’d decorate the class definition with @ray.remote() and in the body write something like myNode = Node.remote(1,2)

In java, something like
ActorHandle myNode = Ray.Actor(Node::new).remote(1,2); doesn’t work.
So where do the constructor arguments go?

Seems like you can pass in a factory method and the values in Ray.Actor:

Thanks. I’ll give that a shot. But it seems that’s not actually calling the constructor, but instead an initializer routine.

I think I just discovered that there’s a limitation (six?) as to how many parameters can be passed, and that’s why my initialization is failing (at build time).

If that’s true, it’s a pretty big unannounced limitation. I’m way to new at java to suggest a workaround.

It can be solved by generating more java code by template here: ray/ at 43f70faa259db44de1977ee8356b66785c0bc761 · ray-project/ray · GitHub

Due to the limitation of the java type system, declaring an actor type of n parameters requires O(2^n) lines of code (at least for the current implementation). I think this is why this now only supports up to 6 arguments.

This reminds me of a similar problem for Microsoft, where their Action delegation only supports up to 16 parameters due to type system limit (arbitrary length would require defining infinite number of types): Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> Delegate (System) | Microsoft Docs

Well, the easier way is to split the call / initialization into multiple sequential calls, with the last one doing the work. Cumbersome, but it works.

The correct way is

ActorHandle<Node> myNode =, 1, 2).remote();