我最近有一个问题,即使是一个简单的akka微内核模型的应用程序。它不能停留在亚马逊ec2。这里是日志
Starting Akka...
Running Akka 2.0.5
Deploying file:/data/akka-scala/akka-2.0.5/deploy/catchif2_2.9.2-0.1-SNAPSHOT.jar
[DEBUG] [03/02/2013 09:35:32.626] [main] [EventStream] StandardOutLogger started
[DEBUG] [03/02/2013 09:35:33.415] [main] [EventStream(akka://hellokernel)] logger log1-Slf4jEventHandler started
[DEBUG] [03/02/2013 09:35:33.416] [main] [EventStream(akka://hellokernel)] Default Loggers started
Starting up com.catchif.HelloKernel
Successfully started Akka
Shutting down Akka...
Shutting down com.catchif.HelloKernel
Received message 'HELLO world!'
Successfully shut down Akka
基本上它会立即自动启动和关闭。
我在我的Mac电脑上运行同样的代码。它保持完美。日志中除了这个之外没有额外的信息:
03/02 09:35:33 INFO [hellokernel-akka.actor.default-dispatcher-4] a.e.s.Slf4jEventHandler - Slf4jEventHandler started
03/02 09:35:33 DEBUG[hellokernel-akka.actor.default-dispatcher-3] a.e.EventStream - logger log1-Slf4jEventHandler started
03/02 09:35:33 DEBUG[hellokernel-akka.actor.default-dispatcher-3] a.e.EventStream - Default Loggers started
代码也非常简单。
import akka.actor.{ Actor, ActorSystem, Props }
import akka.kernel.Bootable
case object Start
class HelloActor extends Actor {
val worldActor = context.actorOf(Props[WorldActor])
def receive = {
case Start ⇒ worldActor ! "Hello"
case message: String ⇒
println("Received message '%s'" format message)
}
}
class WorldActor extends Actor {
def receive = {
case message: String ⇒ sender ! (message.toUpperCase + " world!")
}
}
class HelloKernel extends Bootable {
val system = ActorSystem("hellokernel")
def startup = {
system.actorOf(Props[HelloActor]) ! Start
}
def shutdown = {
system.shutdown()
}
}
不知道为什么会这样。我确实看到它在亚马逊上停留了一次,但后来一直失败。
先谢谢你贝斯特詹姆斯
1条答案
按热度按时间htrmnn0y1#
试试这个告诉我会发生什么:
这是一个极简的实现,应该保持bash shell,直到你按下ctrl-c。如果这工作,那么我会说你的可引导类的扩展有问题(你错过了一些东西)。