finished remote actors (with tests) plus half-baked distributed transactions (not complete)
This commit is contained in:
parent
10a0c16cb2
commit
a585e0ce38
19 changed files with 1055 additions and 817 deletions
|
|
@ -6,6 +6,7 @@ package se.scalablesolutions.akka.kernel.stm
|
|||
|
||||
import java.util.concurrent.atomic.{AtomicInteger, AtomicLong}
|
||||
import kernel.util.Logging
|
||||
|
||||
import scala.collection.mutable.{HashSet, HashMap}
|
||||
|
||||
@serializable sealed abstract class TransactionStatus
|
||||
|
|
@ -38,7 +39,7 @@ object TransactionIdFactory {
|
|||
log.debug("Creating a new transaction with id [%s]", id)
|
||||
|
||||
// FIXME: add support for nested transactions
|
||||
private[this] var parent: Option[Transaction] = None
|
||||
//private[this] var parent: Option[Transaction] = None
|
||||
private[this] val participants = new HashSet[ChangeSet]
|
||||
private[this] val precommitted = new HashSet[ChangeSet]
|
||||
private[this] val depth = new AtomicInteger(0)
|
||||
|
|
@ -94,6 +95,8 @@ object TransactionIdFactory {
|
|||
|
||||
def join(changeSet: ChangeSet) = synchronized {
|
||||
ensureIsActive
|
||||
println(" --- log ;" + log)
|
||||
println(" --- changeset ;" + changeSet)
|
||||
log.debug("TX JOIN - Server [%s] is joining transaction [%s]" , changeSet.id, this)
|
||||
changeSet.full.foreach(_.begin)
|
||||
participants + changeSet
|
||||
|
|
@ -113,6 +116,14 @@ object TransactionIdFactory {
|
|||
private def ensureIsActiveOrNew = if (!(status == TransactionStatus.Active || status == TransactionStatus.New))
|
||||
throw new IllegalStateException("Expected ACTIVE or NEW transaction - current status [" + status + "]")
|
||||
|
||||
private[kernel] def reinit = {
|
||||
import net.lag.logging.{Logger, Level}
|
||||
if (log == null) {
|
||||
log = Logger.get(this.getClass.getName)
|
||||
log.setLevel(Level.ALL)
|
||||
}
|
||||
}
|
||||
|
||||
override def equals(that: Any): Boolean = synchronized {
|
||||
that != null &&
|
||||
that.isInstanceOf[Transaction] &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue