`
176915785
  • 浏览: 33147 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Akka 一些异常

 
阅读更多

老版本的AKKA换成新版本会有

Exception in thread "main" java.lang.IllegalArgumentException: cannot use non-static local Creator to create actors; make it static (e.g. local to a static method) or top-level

new UntypedActorFactory() 
{
	public UntypedActor create() 
       {
			return new ReduceActor(aggregateActor);
	}
}

 

 都是UntypedActorFactory造成的。新版已经不使用了。

 

 可以改写成:

	static class newCreator implements Creator<ReduceActor> {

		private static final long serialVersionUID = -1772539428749702579L;

		final ActorRef actorRef;

		public newCreator(ActorRef actorRef) {
			super();
			this.actorRef = actorRef;
		}

		@Override
		public ReduceActor create() throws Exception {
			return new ReduceActor(actorRef);
		}
	}

 这个是个例子,需要根据具体情况进行修改。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics