Fix for message dispatcher attach (and async init)
This commit is contained in:
parent
10ce9d703c
commit
5a9b6b1816
1 changed files with 9 additions and 6 deletions
|
|
@ -72,19 +72,22 @@ abstract class MessageDispatcher extends Serializable {
|
|||
/**
|
||||
* Attaches the specified actor instance to this dispatcher
|
||||
*/
|
||||
final def attach(actor: ActorInstance) {
|
||||
guard withGuard {
|
||||
final def attach(actor: ActorInstance): Unit = {
|
||||
val promise = new ActorPromise(Timeout.never)(this)
|
||||
guard.lock.lock()
|
||||
try {
|
||||
register(actor)
|
||||
val promise = new ActorPromise(Timeout.never)(this)
|
||||
dispatchMessage(new MessageInvocation(actor, Init, promise))
|
||||
promise
|
||||
}.get
|
||||
} finally {
|
||||
guard.lock.unlock()
|
||||
}
|
||||
promise.get
|
||||
}
|
||||
|
||||
/**
|
||||
* Detaches the specified actor instance from this dispatcher
|
||||
*/
|
||||
final def detach(actor: ActorInstance) {
|
||||
final def detach(actor: ActorInstance): Unit = {
|
||||
guard withGuard {
|
||||
unregister(actor)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue