Merge pull request #916 from akka/wip-remove-var-in-unstartedcell-√

Wip remove var in unstartedcell √
This commit is contained in:
Viktor Klang (√) 2012-12-04 04:10:19 -08:00
commit 86a85f8605
2 changed files with 4 additions and 8 deletions

View file

@ -49,7 +49,7 @@ private[akka] class RepointableActorRef(
@volatile private var _lookupDoNotCallMeDirectly: Cell = _
def underlying: Cell = Unsafe.instance.getObjectVolatile(this, cellOffset).asInstanceOf[Cell]
private def lookup = Unsafe.instance.getObjectVolatile(this, lookupOffset).asInstanceOf[Cell]
def lookup = Unsafe.instance.getObjectVolatile(this, lookupOffset).asInstanceOf[Cell]
@tailrec final def swapCell(next: Cell): Cell = {
val old = underlying
@ -173,13 +173,10 @@ private[akka] class UnstartedCell(val systemImpl: ActorSystemImpl,
// use Envelope to keep on-send checks in the same place ACCESS MUST BE PROTECTED BY THE LOCK
private[this] final val queue = new JLinkedList[Any]()
// ACCESS MUST BE PROTECTED BY THE LOCK, is used to detect when messages are sent during replace
private[this] final var isBeingReplaced = false
import systemImpl.settings.UnstartedPushTimeout.{ duration timeout }
def replaceWith(cell: Cell): Unit = locked {
isBeingReplaced = true
try {
while (!queue.isEmpty) {
queue.poll() match {
@ -188,7 +185,6 @@ private[akka] class UnstartedCell(val systemImpl: ActorSystemImpl,
}
}
} finally {
isBeingReplaced = false
self.swapCell(cell)
}
}
@ -234,7 +230,7 @@ private[akka] class UnstartedCell(val systemImpl: ActorSystemImpl,
cell.sendSystemMessage(msg)
} else {
// systemMessages that are sent during replace need to jump to just after the last system message in the queue, so it's processed before other messages
val wasEnqueued = if (isBeingReplaced && !queue.isEmpty()) {
val wasEnqueued = if ((self.lookup ne this) && (self.underlying eq this) && !queue.isEmpty()) {
@tailrec def tryEnqueue(i: JListIterator[Any] = queue.listIterator(), insertIntoIndex: Int = -1): Boolean =
if (i.hasNext())
tryEnqueue(i,

View file

@ -30,7 +30,7 @@ object AkkaBuild extends Build {
organization := "com.typesafe.akka",
version := "2.2-SNAPSHOT",
// FIXME: use 2.10.0 for final
scalaVersion := System.getProperty("akka.scalaVersion", "2.10.0-RC2")
scalaVersion := System.getProperty("akka.scalaVersion", "2.10.0-RC3")
)
lazy val akka = Project(
@ -695,7 +695,7 @@ object Dependencies {
val junit = "junit" % "junit" % "4.10" % "test" // Common Public License 1.0
val logback = "ch.qos.logback" % "logback-classic" % "1.0.7" % "test" // EPL 1.0 / LGPL 2.1
val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test" // MIT
val scalatest = "org.scalatest" % "scalatest" % "1.8-B2" % "test" cross CrossVersion.full // ApacheV2
val scalatest = "org.scalatest" % "scalatest" % "1.8-B1" % "test" cross CrossVersion.full // ApacheV2
val scalacheck = "org.scalacheck" % "scalacheck" % "1.10.0" % "test" cross CrossVersion.full // New BSD
val ariesProxy = "org.apache.aries.proxy" % "org.apache.aries.proxy.impl" % "0.3" % "test" // ApacheV2
val pojosr = "com.googlecode.pojosr" % "de.kalpatec.pojosr.framework" % "0.1.4" % "test" // ApacheV2