Moved a runtime error to compile time
This commit is contained in:
parent
7883b73052
commit
e34819007e
1 changed files with 3 additions and 4 deletions
|
|
@ -221,7 +221,7 @@ object Actor extends Logging {
|
|||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
trait Actor extends TransactionManagement with Logging {
|
||||
implicit protected val self: Option[Actor] = Some(this)
|
||||
implicit protected val self: Some[Actor] = Some(this)
|
||||
// Only mutable for RemoteServer in order to maintain identity across nodes
|
||||
private[akka] var _uuid = UUID.newUuid.toString
|
||||
|
||||
|
|
@ -548,11 +548,10 @@ trait Actor extends TransactionManagement with Logging {
|
|||
* <p/>
|
||||
* Works with both '!' and '!!'.
|
||||
*/
|
||||
def forward(message: Any)(implicit sender: Option[Actor] = None) = {
|
||||
def forward(message: Any)(implicit sender: Some[Actor]) = {
|
||||
if (_isKilled) throw new ActorKilledException("Actor [" + toString + "] has been killed, can't respond to messages")
|
||||
if (_isRunning) {
|
||||
val forwarder = sender.getOrElse(throw new IllegalStateException("Can't forward message when the forwarder/mediator is not an actor"))
|
||||
forwarder.replyTo match {
|
||||
sender.get.replyTo match {
|
||||
case Some(Left(actor)) => postMessageToMailbox(message, Some(actor))
|
||||
case Some(Right(future)) => postMessageToMailboxAndCreateFutureResultWithTimeout(message, timeout, Some(future))
|
||||
case _ => throw new IllegalStateException("Can't forward message when initial sender is not an actor")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue