How could i create an actor with a customized constructor in java ? I have searched through the documentation but didn't found it.
Here is my Actor:
public class ResizePhotoActor extends UntypedActor {
private int width;
private int height;
private String caption;
public ResizePhotoActor(int width, int height, String caption) {
this.height = height;
this.width = width;
this.caption = caption;
}
public void onReceive(Object message) throws Exception {
}
}
I have tried this :
ActorRef imageActorRef = system.actorOf(
Props.create(new ResizePhotoActor(1, 2, "")));
But it doesn't work.
Thank you
ActorRef imageActorRef = system.actorOf(Props.create(ResizePhotoActor.class, 1, 2, ""));
文件: http : //doc.akka.io/docs/akka/current/java/actors.html#Props
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.