1
在下面的代碼阿卡關閉TCP演員
GSM模擬綁定
從未記錄,即使「禁用」的消息被髮送到服務器。我如何正確解除一個akka tcp服務器?
class GsmRouter extends Actor {
import Tcp._
import context.system
val name = this.getClass().getName()
val logger = LoggerFactory.getLogger(name)
def receive = {
case "enable" => IO(Tcp) ! Bind(self, ConfigurationUtils.gsmRouterAddress)
case "disable" => IO(Tcp) ! Unbind
case Unbound =>
logger.info("GSM mock unbound")
case Bound(localAddress) =>
logger.info("GSM mock bound to " + localAddress.getHostName() + ":" + localAddress.getPort())
case CommandFailed(Bind(_,localAddress: InetSocketAddress, _, _)) =>
logger.info("Could not bind to " + localAddress.getHostName() + ":" + localAddress.getPort())
context stop self
case Connected(remote, local) =>
logger.info("Client connected to GSM mock")
val handler = context.actorOf(Props[ConnectionHandler])
val connection = sender
connection ! Register(handler)
}
}
你能更精確嗎?我不明白它在哪裏添加socketActor字段。謝謝! – Coxer
更新了我的文章。 – drexin
啊!其實這就是我已經想到的。不管怎麼說,還是要謝謝你 :) – Coxer