scala - How do I kill a RemoteActor? -
not sure whether missing something. when making actor remote, main method not terminate.
here snippet demonstrates problem.
import scala.actors._ import scala.actors.remote._ object testme { def main(args : array[string]) : unit = { object jim extends daemonactor { // comment out these 2 lines , application terminate remoteactor.alive(12345) remoteactor.register('jim,this) def act { loop { receive { case 'quit => println("\nquiting") exit('normal) case => println(any) } } } } jim.start jim ! "hello" jim ! 'quit } }
put .alive , .register calls inside act() , code terminates.
Comments
Post a Comment