ActorContext instead of ActorRef in HotSwap code parameter. See #1441
This commit is contained in:
parent
f7d6393027
commit
56dc18106b
6 changed files with 11 additions and 11 deletions
|
|
@ -18,7 +18,7 @@ class HotSwapSpec extends AkkaSpec {
|
|||
val a = system.actorOf(new Actor {
|
||||
def receive = { case _ ⇒ _log += "default" }
|
||||
})
|
||||
a ! HotSwap(self ⇒ {
|
||||
a ! HotSwap(context ⇒ {
|
||||
case _ ⇒
|
||||
_log += "swapped"
|
||||
barrier.await
|
||||
|
|
@ -75,7 +75,7 @@ class HotSwapSpec extends AkkaSpec {
|
|||
|
||||
barrier.reset
|
||||
_log = ""
|
||||
a ! HotSwap(self ⇒ {
|
||||
a ! HotSwap(context ⇒ {
|
||||
case "swapped" ⇒
|
||||
_log += "swapped"
|
||||
barrier.await
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class ReceiveTimeoutSpec extends AkkaSpec {
|
|||
|
||||
val swappedLatch = TestLatch()
|
||||
|
||||
timeoutActor ! HotSwap(self ⇒ {
|
||||
timeoutActor ! HotSwap(context ⇒ {
|
||||
case ReceiveTimeout ⇒ swappedLatch.open
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import akka.util.Duration
|
|||
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
|
||||
class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference) {
|
||||
|
||||
"The default configuration file (i.e. akka-actor-reference.conf)" must {
|
||||
"The default configuration file (i.e. reference.conf)" must {
|
||||
"contain all configuration properties for akka-actor that are used in code with their correct defaults" in {
|
||||
|
||||
val settings = system.settings
|
||||
|
|
|
|||
|
|
@ -30,14 +30,14 @@ sealed trait AutoReceivedMessage extends Serializable
|
|||
|
||||
trait PossiblyHarmful
|
||||
|
||||
case class HotSwap(code: ActorRef ⇒ Actor.Receive, discardOld: Boolean = true) extends AutoReceivedMessage {
|
||||
case class HotSwap(code: ActorContext ⇒ Actor.Receive, discardOld: Boolean = true) extends AutoReceivedMessage {
|
||||
|
||||
/**
|
||||
* Java API
|
||||
*/
|
||||
def this(code: akka.japi.Function[ActorRef, Procedure[Any]], discardOld: Boolean) = {
|
||||
this((self: ActorRef) ⇒ {
|
||||
val behavior = code(self)
|
||||
def this(code: akka.japi.Function[ActorContext, Procedure[Any]], discardOld: Boolean) = {
|
||||
this((context: ActorContext) ⇒ {
|
||||
val behavior = code(context)
|
||||
val result: Actor.Receive = { case msg ⇒ behavior(msg) }
|
||||
result
|
||||
}, discardOld)
|
||||
|
|
@ -46,7 +46,7 @@ case class HotSwap(code: ActorRef ⇒ Actor.Receive, discardOld: Boolean = true)
|
|||
/**
|
||||
* Java API with default non-stacking behavior
|
||||
*/
|
||||
def this(code: akka.japi.Function[ActorRef, Procedure[Any]]) = this(code, true)
|
||||
def this(code: akka.japi.Function[ActorContext, Procedure[Any]]) = this(code, true)
|
||||
}
|
||||
|
||||
case class Failed(cause: Throwable) extends AutoReceivedMessage with PossiblyHarmful
|
||||
|
|
|
|||
|
|
@ -509,7 +509,7 @@ private[akka] final class ActorCell(
|
|||
if (system.settings.DebugAutoReceive) system.eventStream.publish(Debug(self.path.toString, "received AutoReceiveMessage " + msg))
|
||||
|
||||
msg.message match {
|
||||
case HotSwap(code, discardOld) ⇒ become(code(self), discardOld)
|
||||
case HotSwap(code, discardOld) ⇒ become(code(this), discardOld)
|
||||
case RevertHotSwap ⇒ unbecome()
|
||||
case Failed(cause) ⇒ handleFailure(sender, cause)
|
||||
case Kill ⇒ throw new ActorKilledException("Kill")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import akka.testkit.AkkaSpec
|
|||
@RunWith(classOf[JUnitRunner])
|
||||
class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference) {
|
||||
|
||||
"The default configuration file (i.e. akka-stm-reference.conf)" should {
|
||||
"The default configuration file (i.e. reference.conf)" should {
|
||||
"contain all configuration properties for akka-stm that are used in code with their correct defaults" in {
|
||||
val config = system.settings.config
|
||||
import config._
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue