コード例 #1
0
ファイル: ResilientUTS.java プロジェクト: x10-lang/apgas
 void transfer(int thief, UTS loot) {
   final UTS bag = this.bag.trim();
   final int me = this.me;
   final int wave = ResilientUTS.this.wave;
   hz.executeTransaction(
       (TransactionalTaskContext context) -> {
         final TransactionalMap<Integer, UTS> map = context.getMap("map" + wave);
         map.set(me, bag);
         final UTS old = map.getForUpdate(thief);
         loot.count = old == null ? 0 : old.count;
         map.set(thief, loot);
         return null;
       });
 }