fixed TX Vector and TX Ref plus added tests + rewrote Reactor impl + added custom Actor impl(currently not used though)

This commit is contained in:
Jonas Boner 2009-06-05 22:08:53 +02:00
parent 74bd8dea6d
commit 167b724671
15 changed files with 1148 additions and 274 deletions

View file

@ -4,8 +4,9 @@
package se.scalablesolutions.akka.kernel
import java.util.concurrent.atomic.AtomicLong
import java.util.concurrent.atomic.{AtomicInteger, AtomicLong}
import scala.collection.mutable.{HashSet, HashMap}
sealed abstract class TransactionStatus
object TransactionStatus {
case object New extends TransactionStatus
@ -39,8 +40,13 @@ class Transaction extends Logging {
private[this] var parent: Option[Transaction] = None
private[this] val participants = new HashSet[GenericServerContainer]
private[this] val precommitted = new HashSet[GenericServerContainer]
private[this] val depth = new AtomicInteger(0)
@volatile private[this] var status: TransactionStatus = TransactionStatus.New
def increment = depth.incrementAndGet
def decrement = depth.decrementAndGet
def topLevel_? = depth.get == 0
def begin(server: GenericServerContainer) = synchronized {
ensureIsActiveOrNew
if (status == TransactionStatus.New) log.info("Server [%s] is starting NEW transaction [%s]", server.id, this)