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; }); }