Skip to content

Commit

Permalink
Merge pull request #916 from akka/wip-remove-var-in-unstartedcell-√
Browse files Browse the repository at this point in the history
Wip remove var in unstartedcell √
  • Loading branch information
viktorklang committed Dec 4, 2012
2 parents 6a803e4 + 6140892 commit 86a85f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -188,7 +185,6 @@ private[akka] class UnstartedCell(val systemImpl: ActorSystemImpl,
}
}
} finally {
isBeingReplaced = false
self.swapCell(cell)
}
}
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions project/AkkaBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 86a85f8

Please sign in to comment.