akka-remote: Starting the remote server multiple times
I had copied and pasted code from some samples and so, I ended up with code like this:
But since I was running inside the microkernel, the remote server had already been started (and on port 2552).
While this is clearly an instance of me being stupid, it would've been nice if the failure mode were more obvious here.
Could that throw an exception if it were already started? Something?
override def preStart = {
Actor.remote.start("localhost", 2553);
Actor.remote.register("account:service", self)
}
But since I was running inside the microkernel, the remote server had already been started (and on port 2552).
While this is clearly an instance of me being stupid, it would've been nice if the failure mode were more obvious here.
Could that throw an exception if it were already started? Something?
Leave a comment
on 2011-04-29 15:57 *
By viktorklang
Yeah, we should probably do that, but also, starting the remoting in a preStart callback is really not a cool thing to do.
on 2011-04-29 16:04 *
By bruce.mitchener
Among others, akka-samples/akka-sample-chat/src/main/scala/ChatServer.scala does that with a preStart method. Want a separate ticket for that? :)
on 2011-04-30 14:36 *
By viktorklang
Alright, here's what I suggest,
utilize remote.isRunning before calling remote.start, I don't want to start to throw exceptions for 1.1 or 1.2 if we're going to rewrite the remoting for 2.0, I'll move this for 2.0.
utilize remote.isRunning before calling remote.start, I don't want to start to throw exceptions for 1.1 or 1.2 if we're going to rewrite the remoting for 2.0, I'll move this for 2.0.
Starting the remoting should be done in one place only.
Updating tickets (#818, #821, #823, #836, #842, #854, #856, #865, #866, #867, #868, #869, #871, #872, #873, #877, #878, #879, #885, #888, #889, #890, #894, #910, #911, #917, #923, #924, #925, #926, #927, #928, #930, #931, #932, #933, #934, #936, #937, #952, #955, #957, #958, #959, #960, #961, #964, #965, #966)