Update to ScalaSTM 0.5 (which includes Java API)

This commit is contained in:
Peter Vlugter 2012-02-06 11:34:47 +13:00
parent 59d6e93af4
commit 3fbd18f0fa
11 changed files with 27 additions and 346 deletions

View file

@ -8,10 +8,10 @@ package akka.docs.transactor;
import akka.actor.*;
import akka.transactor.*;
import scala.concurrent.stm.Ref;
import scala.concurrent.stm.japi.Stm;
import scala.concurrent.stm.japi.STM;
public class CoordinatedCounter extends UntypedActor {
private Ref.View<Integer> count = Stm.newRef(0);
private Ref.View<Integer> count = STM.newRef(0);
public void onReceive(Object incoming) throws Exception {
if (incoming instanceof Coordinated) {
@ -24,7 +24,7 @@ public class CoordinatedCounter extends UntypedActor {
}
coordinated.atomic(new Runnable() {
public void run() {
Stm.increment(count, 1);
STM.increment(count, 1);
}
});
}