added possibility to register a remote actor by explicit handle id

This commit is contained in:
Jonas Bonér 2010-02-17 15:32:17 +01:00
parent 963d76beae
commit d76d69f620
3 changed files with 18 additions and 57 deletions

View file

@ -191,10 +191,22 @@ class RemoteServer extends Logging {
}
// TODO: register active object in RemoteServer as well
/**
* Register Remote Actor by the Actor's 'id' field.
*/
def register(actor: Actor) = if (isRunning) {
log.info("Registering server side remote actor [%s] with id [%s]", actor.getClass.getName, actor.id)
RemoteServer.actorsFor(RemoteServer.Address(hostname, port)).actors.put(actor.id, actor)
}
/**
* Register Remote Actor by a specific 'id' passed as argument.
*/
def register(id: String, actor: Actor) = if (isRunning) {
log.info("Registering server side remote actor [%s] with id [%s]", actor.getClass.getName, id)
RemoteServer.actorsFor(RemoteServer.Address(hostname, port)).actors.put(id, actor)
}
}
case class Codec(encoder : ChannelHandler, decoder : ChannelHandler)