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 = {
|
protected[akka] def postMessageToMailbox(message: Any, senderOption: Option[ActorRef]): Unit = {
|
||||||
joinTransaction(message)
|
joinTransaction(message)
|
||||||
|
|
||||||
if (isRemotingEnabled && remoteAddress.isDefined) {
|
if (remoteAddress.isDefined && isRemotingEnabled) {
|
||||||
RemoteClientModule.send[Any](
|
RemoteClientModule.send[Any](
|
||||||
message, senderOption, None, remoteAddress.get, timeout, true, this, None, ActorType.ScalaActor)
|
message, senderOption, None, remoteAddress.get, timeout, true, this, None, ActorType.ScalaActor)
|
||||||
} else {
|
} else {
|
||||||
val invocation = new MessageInvocation(this, message, senderOption, None, transactionSet.get)
|
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] = {
|
senderFuture: Option[CompletableFuture[T]]): CompletableFuture[T] = {
|
||||||
joinTransaction(message)
|
joinTransaction(message)
|
||||||
|
|
||||||
if (isRemotingEnabled && remoteAddress.isDefined) {
|
if (remoteAddress.isDefined && isRemotingEnabled) {
|
||||||
val future = RemoteClientModule.send[T](
|
val future = RemoteClientModule.send[T](
|
||||||
message, senderOption, senderFuture, remoteAddress.get, timeout, false, this, None, ActorType.ScalaActor)
|
message, senderOption, senderFuture, remoteAddress.get, timeout, false, this, None, ActorType.ScalaActor)
|
||||||
if (future.isDefined) future.get
|
if (future.isDefined) future.get
|
||||||
|
|
@ -998,7 +998,7 @@ class LocalActorRef private[akka](
|
||||||
else new DefaultCompletableFuture[T](timeout)
|
else new DefaultCompletableFuture[T](timeout)
|
||||||
val invocation = new MessageInvocation(
|
val invocation = new MessageInvocation(
|
||||||
this, message, senderOption, Some(future.asInstanceOf[CompletableFuture[Any]]), transactionSet.get)
|
this, message, senderOption, Some(future.asInstanceOf[CompletableFuture[Any]]), transactionSet.get)
|
||||||
invocation.send
|
dispatcher dispatch invocation
|
||||||
future
|
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).")
|
"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 {
|
override def hashCode(): Int = synchronized {
|
||||||
var result = HashCode.SEED
|
var result = HashCode.SEED
|
||||||
result = HashCode.hash(result, receiver.actor)
|
result = HashCode.hash(result, receiver.actor)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue