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:
parent
2058765485
commit
27da7c4d12
7 changed files with 75 additions and 47 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue