在演员中我创建了一个像下面的儿童演员
ActorRef sessionEventHandlerActor = getContext().actorOf(Props.create(SessionHandler.class), sessionId);
这是SessionHandler actor:
public class SessionHandler extends UntypedActor {
public SessionHandler() {
getContext().setReceiveTimeout(Duration.create(1, TimeUnit.MINUTES));
}
@Override
public void onReceive(Object message) throws Exception {
}
}
我收到以下错误:
Caused by: akka.actor.ActorInitializationException: You cannot create an instance of [actors.SessionHandler] explicitly using the constructor (new). You have to use one of the 'actorOf' factory methods to create a new actor. See the documentation.
at akka.actor.ActorInitializationException$.apply(Actor.scala:165)
at akka.actor.Actor$class.$init$(Actor.scala:421)
at akka.actor.UntypedActor.<init>(UntypedActor.scala:97)
at org.esi.actors.SessionHandler.<init>(SessionHandler.java:22)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at akka.util.Reflect$.instantiate(Reflect.scala:45)
at akka.actor.NoArgsReflectConstructor.produce(Props.scala:358)
at akka.actor.Props.newActor(Props.scala:249)
at akka.actor.ActorCell.newActor(ActorCell.scala:552)
at akka.actor.ActorCell.create(ActorCell.scala:578)
我没有看到我如何创建演员的任何问题。有人知道问题是什么吗?
谢谢
答案 0 :(得分:0)
我认为已经没有问题,但我认为你需要省略sessionId参数,因为create会尝试将它应用到构造函数。
$(window).resize(function() {
$('#slider-home .slider-session').slick('resize');
$('#seguradoras-carrousel .slider-session').slick('resize');
});
据我所知,Java API。我只在scala中使用它。