object RemoteEchoServer extends App {
remote.start("localhost", 1111)
remote.register("hello-service", actorOf[HelloWorldActor])
}
object RemoteEchoClient extends App {
val actor = remote.actorFor("hello-service", "localhost", 1111)
val reply = actor !! "Hello"
println(reply)
actor ! "Stop"
actor ! PoisonPill
}
/**
* a remote actor servers for message "Hello" and response with a message "World"
* it is silly
*/
class HelloWorldActor extends Actor {
def receive = {
case "Hello" =>
println("receiving a Hello message,and a World message will rply")
self.reply("World")
case "Stop" =>
println("stopping...")
remote.shutdown()
}
}
を殺すことはありませんが、遠隔自体を終了することはありません。 remote.shutdown()を呼び出すことによって、オブジェクトRemoteEchoServerのリモートアクタを強制終了する必要があります。 「Stop」メッセージを受け取ってリモートアクタをシャットダウンする方法は?remote.shutdown()は、クライアントが<strong>PoisonPill</strong>だけでなく、「停止」信号を送るアッカリモート俳優自体
私は(出口を知っている)は、おそらく直接サーバーアプリを終了し、まだ存在する場合、プロセスへのニーズを要求するものだろう。
キーポイントはremote.shutdown()は決してシャットダウン、リモート・サービス(サーバアプリ)を呼び出しているので、私は
?!:だからPoisonPillを忘れて、ただ
Stop
メッセージを使用 – fresskomaなぜ、1つのアクタを閉じるだけで、リモーティングサービス全体をシャットダウンするのですか? –
あなたはまた –