Take advantage of short-circuit to avoid lazy init if possible
This commit is contained in:
parent
985882f6c3
commit
acbcd9ef54
2 changed files with 4 additions and 6 deletions
|
|
@ -972,12 +972,12 @@ class LocalActorRef private[akka](
|
|||
protected[akka] def postMessageToMailbox(message: Any, senderOption: Option[ActorRef]): Unit = {
|
||||
joinTransaction(message)
|
||||
|
||||
if (isRemotingEnabled && remoteAddress.isDefined) {
|
||||
if (remoteAddress.isDefined && isRemotingEnabled) {
|
||||
RemoteClientModule.send[Any](
|
||||
message, senderOption, None, remoteAddress.get, timeout, true, this, None, ActorType.ScalaActor)
|
||||
} else {
|
||||
val invocation = new MessageInvocation(this, message, senderOption, None, transactionSet.get)
|
||||
invocation.send
|
||||
dispatcher dispatch invocation
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -988,7 +988,7 @@ class LocalActorRef private[akka](
|
|||
senderFuture: Option[CompletableFuture[T]]): CompletableFuture[T] = {
|
||||
joinTransaction(message)
|
||||
|
||||
if (isRemotingEnabled && remoteAddress.isDefined) {
|
||||
if (remoteAddress.isDefined && isRemotingEnabled) {
|
||||
val future = RemoteClientModule.send[T](
|
||||
message, senderOption, senderFuture, remoteAddress.get, timeout, false, this, None, ActorType.ScalaActor)
|
||||
if (future.isDefined) future.get
|
||||
|
|
@ -998,7 +998,7 @@ class LocalActorRef private[akka](
|
|||
else new DefaultCompletableFuture[T](timeout)
|
||||
val invocation = new MessageInvocation(
|
||||
this, message, senderOption, Some(future.asInstanceOf[CompletableFuture[Any]]), transactionSet.get)
|
||||
invocation.send
|
||||
dispatcher dispatch invocation
|
||||
future
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@ final class MessageInvocation(val receiver: ActorRef,
|
|||
"Don't call 'self ! message' in the Actor's constructor (e.g. body of the class).")
|
||||
}
|
||||
|
||||
def send = receiver.dispatcher.dispatch(this)
|
||||
|
||||
override def hashCode(): Int = synchronized {
|
||||
var result = HashCode.SEED
|
||||
result = HashCode.hash(result, receiver.actor)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue