Update java-friendly api for scala stm

- move to japi.Stm
- add newMap, newSet, newList methods with java conversions
- add afterCompletion lifecycle callback
This commit is contained in:
Peter Vlugter 2012-01-20 11:31:28 +13:00
parent 2058765485
commit 27da7c4d12
7 changed files with 75 additions and 47 deletions

View file

@ -7,14 +7,14 @@ package akka.docs.transactor;
//#class
import akka.transactor.*;
import scala.concurrent.stm.Ref;
import static scala.concurrent.stm.JavaAPI.*;
import scala.concurrent.stm.japi.Stm;
public class Counter extends UntypedTransactor {
Ref.View<Integer> count = newRef(0);
Ref.View<Integer> count = Stm.newRef(0);
public void atomically(Object message) {
if (message instanceof Increment) {
increment(count, 1);
Stm.increment(count, 1);
}
}